[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
This commit is contained in:
Luke Lau
2025-04-29 20:35:19 +08:00
committed by GitHub
parent 2f976956e5
commit b0f2bfc7e4

View File

@@ -177,8 +177,11 @@ public:
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)
return tryInsertInstruction(new VPInstructionWithType(
Opcode, Operands, ResultTy, *FMFs, DL, Name));
return tryInsertInstruction(
new VPInstructionWithType(Opcode, Operands, ResultTy, DL, Name));
}
VPInstruction *createOverflowingOp(unsigned Opcode,