[llvm] [LV] Ignore some costs when loop gets fully unrolled (PR #106699)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 9 10:30:38 PST 2024
================
@@ -2682,6 +2682,25 @@ static Value *getExpandedStep(const InductionDescriptor &ID,
return I->second;
}
+/// Knowing that loop \p L executes a single vector iteration, add instructions
+/// that will get simplified and thus should not have any cost to \p
+/// InstsToIgnore.
+static void addFullyUnrolledInstructionsToIgnore(
+ Loop *L, const LoopVectorizationLegality::InductionList &IL,
+ SmallPtrSetImpl<Instruction *> &InstsToIgnore) {
+ auto *Cmp = L->getLatchCmpInst();
+ if (Cmp)
+ InstsToIgnore.insert(Cmp);
+ for (const auto &[IV, IndDesc] : IL) {
+ // Get next iteration value of the induction variable.
+ Instruction *IVInst =
+ cast<Instruction>(IV->getIncomingValueForBlock(L->getLoopLatch()));
+ if (all_of(IVInst->users(),
+ [&](const User *U) { return U == IV || U == Cmp; }))
----------------
kazutakahirata wrote:
I've fixed a warning from this PR with: https://github.com/llvm/llvm-project/commit/9099d694f6f7e84853d6add9c58a6535cdc62b3d
https://github.com/llvm/llvm-project/pull/106699
More information about the llvm-commits
mailing list