If it is known that LHS or RHS of shufflevector instruction is a ConstantVector and only single element from this constant is used in the result, this shufflevector is transformed into an insertelement instruction:
shufflevector V, C, <v1, v2, .., ci, .., vm> -> insertelement V, C[ci],ci-n
Details
Details
Diff Detail
Diff Detail
Event Timeline
Comment Actions
Fixes an issue with shuffling the elements from the other input. In this case we should retain the shuffle.
Comment Actions
This looks OK to me (especially in context to D24182). Anybody else have any comments?
test/Transforms/InstCombine/insert-const-shuf.ll | ||
---|---|---|
16–29 | As-is, this patch will cause a regression here (ie, the chain of inserts does not collapse). But D24182 will fix this? If it's not possible to separate these two patches without causing a regression, then they should be merged together. I'm not able to apply D24182 cleanly after applying this patch, so it may be that something is just not updated? |
As-is, this patch will cause a regression here (ie, the chain of inserts does not collapse). But D24182 will fix this? If it's not possible to separate these two patches without causing a regression, then they should be merged together. I'm not able to apply D24182 cleanly after applying this patch, so it may be that something is just not updated?