Skip to content
Merged
Show file tree
Hide file tree
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
6 changes: 2 additions & 4 deletions llvm/include/llvm/Analysis/IVDescriptors.h
Original file line number Diff line number Diff line change
Expand Up @@ -451,12 +451,10 @@ class InductionDescriptor {
: Instruction::BinaryOpsEnd;
}

/// Returns a reference to the type cast instructions in the induction
/// Returns an ArrayRef to the type cast instructions in the induction
/// update chain, that are redundant when guarded with a runtime
/// SCEV overflow check.
const SmallVectorImpl<Instruction *> &getCastInsts() const {
return RedundantCasts;
}
ArrayRef<Instruction *> getCastInsts() const { return RedundantCasts; }

private:
/// Private constructor - used by \c isInductionPHI.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,7 @@ void LoopVectorizationLegality::addInductionPhi(
// in the vectorized loop body, record them here. All casts could be recorded
// here for ignoring, but suffices to record only the first (as it is the
// only one that may bw used outside the cast sequence).
const SmallVectorImpl<Instruction *> &Casts = ID.getCastInsts();
ArrayRef<Instruction *> Casts = ID.getCastInsts();
if (!Casts.empty())
InductionCastsToIgnore.insert(*Casts.begin());

Expand Down
3 changes: 1 addition & 2 deletions llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6575,8 +6575,7 @@ void LoopVectorizationCostModel::collectValuesToIgnore() {
// detection.
for (const auto &Induction : Legal->getInductionVars()) {
const InductionDescriptor &IndDes = Induction.second;
const SmallVectorImpl<Instruction *> &Casts = IndDes.getCastInsts();
VecValuesToIgnore.insert_range(Casts);
VecValuesToIgnore.insert_range(IndDes.getCastInsts());
}
}

Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ static void removeRedundantInductionCasts(VPlan &Plan) {
// replace it with the original IV. Note that only the final cast is
// expected to have users outside the cast-chain and the dead casts left
// over will be cleaned up later.
auto &Casts = IV->getInductionDescriptor().getCastInsts();
ArrayRef<Instruction *> Casts = IV->getInductionDescriptor().getCastInsts();
VPValue *FindMyCast = IV;
for (Instruction *IRCast : reverse(Casts)) {
VPSingleDefRecipe *FoundUserCast = nullptr;
Expand Down
Loading