Skip to content

Commit ff53a05

Browse files
committed
[VPlan] Improve code using m_APInt (NFC)
1 parent 0a47024 commit ff53a05

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1472,11 +1472,8 @@ static bool optimizeVectorInductionWidthForTCAndVFUF(VPlan &Plan,
14721472
if (!Plan.getVectorLoopRegion())
14731473
return false;
14741474

1475-
if (!Plan.getTripCount()->isLiveIn())
1476-
return false;
1477-
auto *TC = dyn_cast_if_present<ConstantInt>(
1478-
Plan.getTripCount()->getUnderlyingValue());
1479-
if (!TC || !BestVF.isFixed())
1475+
const APInt *TC;
1476+
if (!match(Plan.getTripCount(), m_APInt(TC)) || !BestVF.isFixed())
14801477
return false;
14811478

14821479
// Calculate the minimum power-of-2 bit width that can fit the known TC, VF
@@ -1489,7 +1486,7 @@ static bool optimizeVectorInductionWidthForTCAndVFUF(VPlan &Plan,
14891486
return std::max<unsigned>(PowerOf2Ceil(MaxVal.getActiveBits()), 8);
14901487
};
14911488
unsigned NewBitWidth =
1492-
ComputeBitWidth(TC->getValue(), BestVF.getKnownMinValue() * BestUF);
1489+
ComputeBitWidth(*TC, BestVF.getKnownMinValue() * BestUF);
14931490

14941491
LLVMContext &Ctx = Plan.getContext();
14951492
auto *NewIVTy = IntegerType::get(Ctx, NewBitWidth);

0 commit comments

Comments
 (0)