[llvm] [InstCombine] Fold bitcast (extelt (bitcast X), Idx) into bitcast+shufflevector. (PR #136998)

Ricardo Jesus via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 24 03:11:11 PDT 2025


rj-jesus wrote:

On second thought, I don't think moving this to VectorCombine will work, at least not from the point of view of addressing the regressions I mentioned above.

After InstCombine folds shufflevector+bitcast into bitcast+extractelement, it may perform other folds before we get to VectorCombine that change the IR too much and prevent the fold bitcast+extelt+bitcast -> bitcast+shufflevector from happening (see [here](https://godbolt.org/z/nseWsfM64) for an example based on the second reproducer above).

If the fold proposed in this PR isn't suitable for InstCombine, maybe we should revisit #135769, unless you have another suggestion? What do you think @nikic and @RKSimon?

https://github.com/llvm/llvm-project/pull/136998


More information about the llvm-commits mailing list