aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp
diff options
context:
space:
mode:
authorFlorian Hahn <flo@fhahn.com>2024-12-02 21:35:00 +0000
committerGitHub <noreply@github.com>2024-12-02 21:35:00 +0000
commit4226e0a0c75e5cfd784eff429f93101c03a1995c (patch)
tree8e58e252f00c787575b225aaed06f36d021ef11c /llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp
parent2c88ac9da9f842875592b232ba957da341e62ea5 (diff)
downloadllvm-4226e0a0c75e5cfd784eff429f93101c03a1995c.zip
llvm-4226e0a0c75e5cfd784eff429f93101c03a1995c.tar.gz
llvm-4226e0a0c75e5cfd784eff429f93101c03a1995c.tar.bz2
[TTI] Add SCEVExpansionBudget to loop unrolling options. (#118316)
Add an extra know to UnrollingPreferences to let backends control the maximum budget for SCEV expansions. This gives backends more fine-grained control on the cost of the runtime checks for runtime unrolling. PR: https://github.com/llvm/llvm-project/pull/118316
Diffstat (limited to 'llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp b/llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp
index 0179d35..b0bc55c 100644
--- a/llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp
+++ b/llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp
@@ -582,7 +582,8 @@ bool llvm::UnrollRuntimeLoopRemainder(
Loop *L, unsigned Count, bool AllowExpensiveTripCount,
bool UseEpilogRemainder, bool UnrollRemainder, bool ForgetAllSCEV,
LoopInfo *LI, ScalarEvolution *SE, DominatorTree *DT, AssumptionCache *AC,
- const TargetTransformInfo *TTI, bool PreserveLCSSA, Loop **ResultLoop) {
+ const TargetTransformInfo *TTI, bool PreserveLCSSA,
+ unsigned SCEVExpansionBudget, Loop **ResultLoop) {
LLVM_DEBUG(dbgs() << "Trying runtime unrolling on Loop: \n");
LLVM_DEBUG(L->dump());
LLVM_DEBUG(UseEpilogRemainder ? dbgs() << "Using epilog remainder.\n"
@@ -672,8 +673,8 @@ bool llvm::UnrollRuntimeLoopRemainder(
const DataLayout &DL = Header->getDataLayout();
SCEVExpander Expander(*SE, DL, "loop-unroll");
if (!AllowExpensiveTripCount &&
- Expander.isHighCostExpansion(TripCountSC, L, SCEVCheapExpansionBudget,
- TTI, PreHeaderBR)) {
+ Expander.isHighCostExpansion(TripCountSC, L, SCEVExpansionBudget, TTI,
+ PreHeaderBR)) {
LLVM_DEBUG(dbgs() << "High cost for expanding trip count scev!\n");
return false;
}