Skip to content

[LV] Strip redundant casts (NFC) #128177

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 21, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1243,8 +1243,8 @@ class LoopVectorizationCostModel {
return false;

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

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

unsigned F = static_cast<unsigned>(MaxNestedScalarReductionIC);
unsigned F = MaxNestedScalarReductionIC;
SmallIC = std::min(SmallIC, F);
StoresIC = std::min(StoresIC, F);
LoadsIC = std::min(LoadsIC, F);
Expand Down Expand Up @@ -10303,8 +10303,7 @@ static void preparePlanForMainVectorLoop(VPlan &MainPlan, VPlan &EpiPlan) {
EpiWidenedPhis.insert(
cast<PHINode>(R.getVPSingleValue()->getUnderlyingValue()));
}
for (VPRecipeBase &R : make_early_inc_range(
*cast<VPIRBasicBlock>(MainPlan.getScalarHeader()))) {
for (VPRecipeBase &R : make_early_inc_range(*MainPlan.getScalarHeader())) {
auto *VPIRInst = cast<VPIRInstruction>(&R);
auto *IRI = dyn_cast<PHINode>(&VPIRInst->getInstruction());
if (!IRI)
Expand Down