[llvm] [VPlan] Drop poison-generating flags on induction trunc (PR #168922)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 21 01:54:45 PST 2025


================
@@ -3326,6 +3326,8 @@ expandVPWidenIntOrFpInduction(VPWidenIntOrFpInductionRecipe *WidenIVR,
     assert(StepTy->isIntegerTy() && "Truncation requires an integer type");
     Step = Builder.createScalarCast(Instruction::Trunc, Step, Ty, DL);
     Start = Builder.createScalarCast(Instruction::Trunc, Start, Ty, DL);
+    // Truncation doesn't preserve WrapFlags.
+    Flags.dropPoisonGeneratingFlags();
----------------
fhahn wrote:

We may be improve the results, if the trunc itself has `nuw/nsw`.

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


More information about the llvm-commits mailing list