[llvm] [VPlan] Add VPInstruction::StepVector and use it in VPWidenIntOrFpInductionRecipe (PR #129508)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 28 06:42:47 PDT 2025


================
@@ -177,8 +177,11 @@ class VPBuilder {
                               Type *ResultTy,
                               std::optional<FastMathFlags> FMFs = {},
                               DebugLoc DL = {}, const Twine &Name = "") {
-    return tryInsertInstruction(new VPInstructionWithType(
-        Opcode, Operands, ResultTy, FMFs.value_or(FastMathFlags()), DL, Name));
+    if (FMFs)
----------------
lukel97 wrote:

VPInstruction::StepVector would be the first VPInstructionWithType that doesn't take FastMathFlags. The current VPBuilder::createNaryOp always calls the VPInstructionWithType with FMFs though, which triggers an assertion if you don't pass in any FMFs i.e. in this PR.

The change then fixes up createNaryOp to choose between the FMF and non-FMF constructor, which fixes the assertion failure

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


More information about the llvm-commits mailing list