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
Diff Detail
Event Timeline
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.
Thanks, Matt.
This LGTM, except for some nits.
lib/Transforms/Vectorize/LoopVectorize.cpp | ||
---|---|---|
2364 | The comment is slightly incorrect now ("last" vector lane). | |
2379 | As long as you're touching this, maybe change the variable name? "Width" is weird. | |
2380 | Maybe just build a splat (one insert + shuffle) directly? |
The comment is slightly incorrect now ("last" vector lane).