Skip to content

Commit 2d38be5

Browse files
authored
[LV] Strip redundant casts (NFC) (#128177)
1 parent 13ca605 commit 2d38be5

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1243,8 +1243,8 @@ class LoopVectorizationCostModel {
12431243
return false;
12441244

12451245
// Get the source and destination types of the truncate.
1246-
Type *SrcTy = toVectorTy(cast<CastInst>(I)->getSrcTy(), VF);
1247-
Type *DestTy = toVectorTy(cast<CastInst>(I)->getDestTy(), VF);
1246+
Type *SrcTy = toVectorTy(Trunc->getSrcTy(), VF);
1247+
Type *DestTy = toVectorTy(Trunc->getDestTy(), VF);
12481248

12491249
// If the truncate is free for the given types, return false. Replacing a
12501250
// free truncate with an induction variable would add an induction variable
@@ -5132,7 +5132,7 @@ LoopVectorizationCostModel::selectInterleaveCount(ElementCount VF,
51325132
return 1;
51335133
}
51345134

5135-
unsigned F = static_cast<unsigned>(MaxNestedScalarReductionIC);
5135+
unsigned F = MaxNestedScalarReductionIC;
51365136
SmallIC = std::min(SmallIC, F);
51375137
StoresIC = std::min(StoresIC, F);
51385138
LoadsIC = std::min(LoadsIC, F);
@@ -10303,8 +10303,7 @@ static void preparePlanForMainVectorLoop(VPlan &MainPlan, VPlan &EpiPlan) {
1030310303
EpiWidenedPhis.insert(
1030410304
cast<PHINode>(R.getVPSingleValue()->getUnderlyingValue()));
1030510305
}
10306-
for (VPRecipeBase &R : make_early_inc_range(
10307-
*cast<VPIRBasicBlock>(MainPlan.getScalarHeader()))) {
10306+
for (VPRecipeBase &R : make_early_inc_range(*MainPlan.getScalarHeader())) {
1030810307
auto *VPIRInst = cast<VPIRInstruction>(&R);
1030910308
auto *IRI = dyn_cast<PHINode>(&VPIRInst->getInstruction());
1031010309
if (!IRI)

0 commit comments

Comments
 (0)