diff options
author | Silviu Baranga <silviu.baranga@arm.com> | 2015-11-09 13:26:09 +0000 |
---|---|---|
committer | Silviu Baranga <silviu.baranga@arm.com> | 2015-11-09 13:26:09 +0000 |
commit | 2910a4f6b156580ae1336184340e7b7a0b131f2e (patch) | |
tree | eae881013624d3a7a5cb9a1b825b7a6403232ce0 /llvm/lib/Transforms/Scalar/LoopLoadElimination.cpp | |
parent | 90dafb1b6db0b72059dee3360e82c46af1fda1d1 (diff) | |
download | llvm-2910a4f6b156580ae1336184340e7b7a0b131f2e.zip llvm-2910a4f6b156580ae1336184340e7b7a0b131f2e.tar.gz llvm-2910a4f6b156580ae1336184340e7b7a0b131f2e.tar.bz2 |
Allow LLE/LD and the loop versioning infrastructure to use SCEV predicates
Summary:
LAA currently generates a set of SCEV predicates that must be checked by users.
In the case of Loop Distribute/Loop Load Elimination, no such predicates could have
been emitted, since we don't allow stride versioning. However, in the future there
could be SCEV predicates that will need to be checked.
This change adds support for SCEV predicate versioning in the Loop Distribute, Loop
Load Eliminate and the loop versioning infrastructure.
Reviewers: anemet
Subscribers: mssimpso, sanjoy, llvm-commits
Differential Revision: http://reviews.llvm.org/D14240
llvm-svn: 252467
Diffstat (limited to 'llvm/lib/Transforms/Scalar/LoopLoadElimination.cpp')
-rw-r--r-- | llvm/lib/Transforms/Scalar/LoopLoadElimination.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopLoadElimination.cpp b/llvm/lib/Transforms/Scalar/LoopLoadElimination.cpp index e0456a2..7c7bf64 100644 --- a/llvm/lib/Transforms/Scalar/LoopLoadElimination.cpp +++ b/llvm/lib/Transforms/Scalar/LoopLoadElimination.cpp @@ -41,6 +41,12 @@ static cl::opt<unsigned> CheckPerElim( cl::desc("Max number of memchecks allowed per eliminated load on average"), cl::init(1)); +static cl::opt<unsigned> LoadElimSCEVCheckThreshold( + "loop-load-elimination-scev-check-threshold", cl::init(8), cl::Hidden, + cl::desc("The maximum number of SCEV checks allowed for Loop " + "Load Elimination")); + + STATISTIC(NumLoopLoadEliminted, "Number of loads eliminated by LLE"); namespace { @@ -453,10 +459,17 @@ public: return false; } + if (LAI.Preds.getComplexity() > LoadElimSCEVCheckThreshold) { + DEBUG(dbgs() << "Too many SCEV run-time checks needed.\n"); + return false; + } + // Point of no-return, start the transformation. First, version the loop if // necessary. - if (!Checks.empty()) { - LoopVersioning LV(std::move(Checks), LAI, L, LI, DT); + if (!Checks.empty() || !LAI.Preds.isAlwaysTrue()) { + LoopVersioning LV(LAI, L, LI, DT, SE, false); + LV.setAliasChecks(std::move(Checks)); + LV.setSCEVChecks(LAI.Preds); LV.versionLoop(); } |