If we identify an instruction as uniform after vectorization, we know that we should only use the value corresponding to the first vector lane of each unroll iteration. However, when scalarizing such instructions, we still produce values for the other vector lanes. This patch prevents us from generating the unused scalars.
Details
Details
Diff Detail
Diff Detail
- Repository
- rL LLVM
Event Timeline
Comment Actions
Added assert in getScalarValue.
Now that we're more conservative about the values we mark uniform in collectLoopUniforms, this patch should be ready to go. I added an assert to be safe.
Comment Actions
Thanks, Matt.
This LGTM, except for some nits.
lib/Transforms/Vectorize/LoopVectorize.cpp | ||
---|---|---|
2364 ↗ | (On Diff #71819) | The comment is slightly incorrect now ("last" vector lane). |
2379 ↗ | (On Diff #71819) | As long as you're touching this, maybe change the variable name? "Width" is weird. |
2380 ↗ | (On Diff #71819) | Maybe just build a splat (one insert + shuffle) directly? |