[llvm] [InstCombine] Pull shuffles out of binops with splatted ops (PR #137948)
Luke Lau via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 30 09:16:15 PDT 2025
================
@@ -2271,6 +2271,27 @@ Instruction *InstCombinerImpl::foldVectorBinop(BinaryOperator &Inst) {
}
}
+ // Similar to the combine above, but handles the case for scalable vectors
+ // where both V1 and C are splats.
+ //
+ // Op(shuffle(V1, 0), (splat C)) -> shuffle(Op(V1, (splat C)), 0)
----------------
lukel97 wrote:
There's a check for `isSafeToSpeculativelyExecuteWithVariableReplaced` earlier on in the function which the previous combine also relies on, so I think this should also be covered in the new combine. I've added a negative test in e9d51e74cfeb274d263d85148e74b31937ca49dd
https://github.com/llvm/llvm-project/pull/137948
More information about the llvm-commits
mailing list