[llvm] [VectorCombine] Pass flags during IR creation (PR #193271)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 28 00:31:26 PDT 2026


================
@@ -1445,19 +1445,45 @@ bool VectorCombine::scalarizeOpOrCmp(Instruction &I) {
           cast<Constant>(VecC), Builder.getInt64(*Index));
 
   Value *Scalar;
-  if (CI)
-    Scalar = Builder.CreateCmp(CI->getPredicate(), ScalarOps[0], ScalarOps[1]);
-  else if (UO || BO)
-    Scalar = Builder.CreateNAryOp(Opcode, ScalarOps);
-  else
+  // We need to pass the flags during the creation of instrucitons. Constant
+  // folding might remove the instructions, so post setting the flags might
+  // pollute the later instructions.
+  if (CI) {
+    if (FPMathOperator *FPMO = dyn_cast<FPMathOperator>(&I))
----------------
arsenm wrote:

Braces 

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


More information about the llvm-commits mailing list