[llvm] [VectorCombine] Fold binop(shuffle(V1, Mask), shuffle(V2, Mask)) -> shuffle(binop(V1, V2), Mask) (PR #211530)
Yingwei Zheng via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 23 07:32:29 PDT 2026
- Previous message: [llvm] [VectorCombine] Fold binop(shuffle(V1, Mask), shuffle(V2, Mask)) -> shuffle(binop(V1, V2), Mask) (PR #211530)
- Next message: [llvm] [VectorCombine] Fold binop(shuffle(V1, Mask), shuffle(V2, Mask)) -> shuffle(binop(V1, V2), Mask) (PR #211530)
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
================
@@ -2443,6 +2444,70 @@ bool VectorCombine::foldConcatOfBoolMasks(Instruction &I) {
return true;
}
+// Fold binop(shuffle(V0, Mask), shuffle(V1, Mask))
+// --> shuffle(binop(V0, V1), Mask)
+bool VectorCombine::foldBinopOfShuffles(Instruction &I) {
+ // It is not safe to transform things like div, urem, etc. because we may
+ // create undefined behavior when executing those on unknown vector elements.
+ if (!isSafeToSpeculativelyExecute(&I))
----------------
dtcxzyw wrote:
Looks like it doesn't guard against FP ops with strictfp, right? This transformation may introduce new floating-point exceptions.
https://github.com/llvm/llvm-project/pull/211530
- Previous message: [llvm] [VectorCombine] Fold binop(shuffle(V1, Mask), shuffle(V2, Mask)) -> shuffle(binop(V1, V2), Mask) (PR #211530)
- Next message: [llvm] [VectorCombine] Fold binop(shuffle(V1, Mask), shuffle(V2, Mask)) -> shuffle(binop(V1, V2), Mask) (PR #211530)
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the llvm-commits
mailing list