Skip to content

Commit b0f2bfc

Browse files
authored
[VPlan] Use correct non-FMF constructor in VPInstructionWithType createNaryOp (#137632)
Currently if we try to create a VPInstructionWithType without a FMF via VPBuilder::createNaryOp we will use the constructor that asserts `assert(isFPMathOp() && "this op can't take fast-math flags");`. This fixes it by checking if FMFs have a value, similar to the other createNaryOp overloads. This is needed by #129508
1 parent 2f97695 commit b0f2bfc

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,11 @@ class VPBuilder {
177177
Type *ResultTy,
178178
std::optional<FastMathFlags> FMFs = {},
179179
DebugLoc DL = {}, const Twine &Name = "") {
180-
return tryInsertInstruction(new VPInstructionWithType(
181-
Opcode, Operands, ResultTy, FMFs.value_or(FastMathFlags()), DL, Name));
180+
if (FMFs)
181+
return tryInsertInstruction(new VPInstructionWithType(
182+
Opcode, Operands, ResultTy, *FMFs, DL, Name));
183+
return tryInsertInstruction(
184+
new VPInstructionWithType(Opcode, Operands, ResultTy, DL, Name));
182185
}
183186

184187
VPInstruction *createOverflowingOp(unsigned Opcode,

0 commit comments

Comments
 (0)