[llvm] [LoopUnroll] UnrollRuntimeMultiExit takes precedence over TTI. (PR #134259)
David Green via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 3 11:17:45 PDT 2025
================
@@ -633,14 +629,21 @@ bool llvm::UnrollRuntimeLoopRemainder(
if (!PreserveLCSSA)
return false;
- if (!RuntimeUnrollMultiExit &&
- !canProfitablyRuntimeUnrollMultiExitLoop(L, OtherExits, LatchExit,
- UseEpilogRemainder)) {
- LLVM_DEBUG(
- dbgs()
- << "Multiple exit/exiting blocks in loop and multi-exit unrolling not "
- "enabled!\n");
- return false;
+ // Priority goes to UnrollRuntimeMultiExit if it's supplied.
+ if (UnrollRuntimeMultiExit.getNumOccurrences()) {
+ if (!UnrollRuntimeMultiExit)
+ return false;
+ } else {
+ // Otherwise perform multi-exit unrolling, if either the target indicates
+ // it is profitable or the general profitability heuristics apply.
+ if (!RuntimeUnrollMultiExit &&
+ !canProfitablyRuntimeUnrollMultiExitLoop(L, OtherExits, LatchExit,
+ UseEpilogRemainder)) {
+ LLVM_DEBUG(dbgs() << "Multiple exit/exiting blocks in loop and "
+ "multi-exit unrolling not "
+ "enabled!\n");
----------------
davemgreen wrote:
enabled! can be combined with the previous line.
https://github.com/llvm/llvm-project/pull/134259
More information about the llvm-commits
mailing list