[llvm] [LV] Ignore some costs when loop gets fully unrolled (PR #106699)
David Sherwood via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 6 04:46:42 PST 2024
================
@@ -2652,6 +2652,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)
----------------
david-arm wrote:
You may be right, but have you tried this out with real IR? There would be more than one use of the cmp so I wasn't sure if InstCombine would apply the fold in this case. In any case, adding an extra one use check wouldn't affect the loops you care about I think?
https://github.com/llvm/llvm-project/pull/106699
More information about the llvm-commits
mailing list