[llvm] [InstCombine] Pull shuffles out of binops with splatted ops (PR #137948)
Philip Reames via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 30 15:33:19 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)
----------------
preames wrote:
Right, but the transform you're modeling off just above has several other checks for introducing UB. The mask logic is one, the getSafeVectorConstantForBinop is another. I'm not sure the mask reasoning is needed for this one, but the divrem/shift definitely is? If not, why is the previous block required?
https://github.com/llvm/llvm-project/pull/137948
More information about the llvm-commits
mailing list