Skip to content

Commit 8a8466a

Browse files
committed
[VPlan] Improve code using m_APInt (NFC)
1 parent e04ab76 commit 8a8466a

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
@@ -1448,11 +1448,8 @@ static bool optimizeVectorInductionWidthForTCAndVFUF(VPlan &Plan,
14481448
if (!Plan.getVectorLoopRegion())
14491449
return false;
14501450

1451-
if (!Plan.getTripCount()->isLiveIn())
1452-
return false;
1453-
auto *TC = dyn_cast_if_present<ConstantInt>(
1454-
Plan.getTripCount()->getUnderlyingValue());
1455-
if (!TC || !BestVF.isFixed())
1451+
const APInt *TC;
1452+
if (!match(Plan.getTripCount(), m_APInt(TC)) || !BestVF.isFixed())
14561453
return false;
14571454

14581455
// Calculate the minimum power-of-2 bit width that can fit the known TC, VF
@@ -1465,7 +1462,7 @@ static bool optimizeVectorInductionWidthForTCAndVFUF(VPlan &Plan,
14651462
return std::max<unsigned>(PowerOf2Ceil(MaxVal.getActiveBits()), 8);
14661463
};
14671464
unsigned NewBitWidth =
1468-
ComputeBitWidth(TC->getValue(), BestVF.getKnownMinValue() * BestUF);
1465+
ComputeBitWidth(*TC, BestVF.getKnownMinValue() * BestUF);
14691466

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

0 commit comments

Comments
 (0)