Skip to content

Commit 94c85b3

Browse files
artagnonaokblast
authored andcommitted
[VPlan] Improve code using m_APInt (NFC) (llvm#161683)
1 parent 19bc07a commit 94c85b3

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
@@ -1478,11 +1478,8 @@ static bool optimizeVectorInductionWidthForTCAndVFUF(VPlan &Plan,
14781478
if (!Plan.getVectorLoopRegion())
14791479
return false;
14801480

1481-
if (!Plan.getTripCount()->isLiveIn())
1482-
return false;
1483-
auto *TC = dyn_cast_if_present<ConstantInt>(
1484-
Plan.getTripCount()->getUnderlyingValue());
1485-
if (!TC || !BestVF.isFixed())
1481+
const APInt *TC;
1482+
if (!BestVF.isFixed() || !match(Plan.getTripCount(), m_APInt(TC)))
14861483
return false;
14871484

14881485
// Calculate the minimum power-of-2 bit width that can fit the known TC, VF
@@ -1495,7 +1492,7 @@ static bool optimizeVectorInductionWidthForTCAndVFUF(VPlan &Plan,
14951492
return std::max<unsigned>(PowerOf2Ceil(MaxVal.getActiveBits()), 8);
14961493
};
14971494
unsigned NewBitWidth =
1498-
ComputeBitWidth(TC->getValue(), BestVF.getKnownMinValue() * BestUF);
1495+
ComputeBitWidth(*TC, BestVF.getKnownMinValue() * BestUF);
14991496

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

0 commit comments

Comments
 (0)