[llvm] [InstCombine] Do not combine shuffle+bitcast if the bitcast is eliminable. (PR #135769)

Ricardo Jesus via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 17 05:42:16 PDT 2025


rj-jesus wrote:

> The alternative here would be to fold the
> 
> ```
>   %s.bc = bitcast <8 x i32> %v to <2 x i128>
>   %s.extract = extractelement <2 x i128> %s.bc, i64 0
>   %c = bitcast i128 %s.extract to <16 x i8>
> ```
> 
> pattern to shufflevector + bitcast instead. That would seem like the more robust solution. Do you think that would be viable, or does that run up against some other problem (I guess introducing shufflevectors without cost model may be problematic?)

Going that route seemed more complex, and I wasn't sure if it could have unintended consequences elsewhere (as you say, because of the shufflevectors). Would you like me to give it a try, though?

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


More information about the llvm-commits mailing list