[llvm] b43a007 - [VPlan] Introduce VPIRFlags::getNWFlagsOrNone (NFC) (#207176)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 14 11:49:34 PDT 2026
Author: Ramkumar Ramachandra
Date: 2026-07-14T19:49:29+01:00
New Revision: b43a0072fa011ec50c29b683da057730b2682ae2
URL: https://github.com/llvm/llvm-project/commit/b43a0072fa011ec50c29b683da057730b2682ae2
DIFF: https://github.com/llvm/llvm-project/commit/b43a0072fa011ec50c29b683da057730b2682ae2.diff
LOG: [VPlan] Introduce VPIRFlags::getNWFlagsOrNone (NFC) (#207176)
Similar to getFMFOrNone. Also introduce a default WrapFlagsTy
constructor to go along with it.
Added:
Modified:
llvm/lib/Transforms/Vectorize/VPlan.h
llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
llvm/lib/Transforms/Vectorize/VPlanUnroll.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Vectorize/VPlan.h b/llvm/lib/Transforms/Vectorize/VPlan.h
index 47c34157533e4..15c1e2d2db0ba 100644
--- a/llvm/lib/Transforms/Vectorize/VPlan.h
+++ b/llvm/lib/Transforms/Vectorize/VPlan.h
@@ -711,6 +711,7 @@ class VPIRFlags {
char HasNSW : 1;
WrapFlagsTy(bool HasNUW, bool HasNSW) : HasNUW(HasNUW), HasNSW(HasNSW) {}
+ WrapFlagsTy() : HasNUW(false), HasNSW(false) {}
};
struct TruncFlagsTy {
@@ -1030,13 +1031,13 @@ class VPIRFlags {
}
}
- bool hasNoWrapFlags() const {
+ WrapFlagsTy getNoWrapFlagsOrNone() const {
switch (OpType) {
case OperationType::OverflowingBinOp:
case OperationType::Trunc:
- return true;
+ return {hasNoUnsignedWrap(), hasNoSignedWrap()};
default:
- return false;
+ return {};
}
}
@@ -4099,7 +4100,7 @@ class VPCurrentIterationPHIRecipe : public VPHeaderPHIRecipe {
class VPWidenCanonicalIVRecipe : public VPRecipeWithIRFlags {
public:
VPWidenCanonicalIVRecipe(VPRegionValue *CanonicalIV,
- const VPIRFlags::WrapFlagsTy &Flags = {false, false})
+ const VPIRFlags::WrapFlagsTy &Flags = {})
: VPRecipeWithIRFlags(VPRecipeBase::VPWidenCanonicalIVSC, CanonicalIV,
CanonicalIV->getType(), Flags) {}
diff --git a/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp b/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
index 1262d7dfa5f05..4089200aee5d8 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
@@ -2985,9 +2985,9 @@ addVPLaneMaskPhiAndUpdateExitBranch(VPlan &Plan) {
VPValue *TC = Plan.getTripCount();
VPValue *VF = &Plan.getVF();
- auto *EntryIncrement = Builder.createOverflowingOp(
- VPInstruction::CanonicalIVIncrementForPart, {StartV, VF}, {false, false},
- DL, "index.part.next");
+ auto *EntryIncrement =
+ Builder.createOverflowingOp(VPInstruction::CanonicalIVIncrementForPart,
+ {StartV, VF}, {}, DL, "index.part.next");
// Create the active lane mask instruction in the VPlan preheader.
VPValue *ALMMultiplier =
@@ -3009,7 +3009,7 @@ addVPLaneMaskPhiAndUpdateExitBranch(VPlan &Plan) {
Builder.setInsertPoint(OriginalTerminator);
auto *InLoopIncrement = Builder.createOverflowingOp(
VPInstruction::CanonicalIVIncrementForPart,
- {CanonicalIVIncrement, &Plan.getVF()}, {false, false}, DL);
+ {CanonicalIVIncrement, &Plan.getVF()}, {}, DL);
auto *ALM = Builder.createNaryOp(VPInstruction::ActiveLaneMask,
{InLoopIncrement, TC, ALMMultiplier}, DL,
"active.lane.mask.next");
diff --git a/llvm/lib/Transforms/Vectorize/VPlanUnroll.cpp b/llvm/lib/Transforms/Vectorize/VPlanUnroll.cpp
index 594c201d5a8cb..4b63a212b808c 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanUnroll.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlanUnroll.cpp
@@ -179,8 +179,7 @@ void UnrollState::unrollWidenInductionByUF(
VPIRFlags::WrapFlagsTy WrapFlags(false, false);
if (auto *IntOrFPInd = dyn_cast<VPWidenIntOrFpInductionRecipe>(IV)) {
FMF = IntOrFPInd->getFastMathFlagsOrNone();
- if (IntOrFPInd->hasNoWrapFlags())
- WrapFlags = IntOrFPInd->getNoWrapFlags();
+ WrapFlags = IntOrFPInd->getNoWrapFlagsOrNone();
}
VPValue *ScalarStep = IV->getStepValue();
More information about the llvm-commits
mailing list