summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorSerguei Katkov <serguei.katkov@azul.com>2018-09-11 04:07:36 +0000
committerSerguei Katkov <serguei.katkov@azul.com>2018-09-11 04:07:36 +0000
commit5f4a9e9ea05f6f99f60b954d213b7ea3a428fef7 (patch)
treea510a798e92cf814c301184e06f3d201ee93bb5e /llvm/lib/Transforms
parent796b0e7a90f75a4773999e97a9868df077fbc97f (diff)
downloadbcm5719-llvm-5f4a9e9ea05f6f99f60b954d213b7ea3a428fef7.tar.gz
bcm5719-llvm-5f4a9e9ea05f6f99f60b954d213b7ea3a428fef7.zip
[LICM] Avoid duplicate work during building AliasSetTracker
Currently we re-use cached info from sub loops or traverse them to populate AliasSetTracker. But after that we traverse all basic blocks from the current loop. This is redundant work. All what we need is traversing the all basic blocks from the loop except those which are used to get the data from the cache. This should improve compile time only. Reviewers: mkazantsev, reames, kariddi, anna Reviewed By: reames Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D51715 llvm-svn: 341896
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Scalar/LICM.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/llvm/lib/Transforms/Scalar/LICM.cpp b/llvm/lib/Transforms/Scalar/LICM.cpp
index 4ebe1e39d95..bb918cf717d 100644
--- a/llvm/lib/Transforms/Scalar/LICM.cpp
+++ b/llvm/lib/Transforms/Scalar/LICM.cpp
@@ -1535,11 +1535,6 @@ LoopInvariantCodeMotion::collectAliasInfoForLoop(Loop *L, LoopInfo *LI,
AliasAnalysis *AA) {
std::unique_ptr<AliasSetTracker> CurAST;
SmallVector<Loop *, 4> RecomputeLoops;
- auto mergeLoop = [&CurAST](Loop *L) {
- // Loop over the body of this loop, looking for calls, invokes, and stores.
- for (BasicBlock *BB : L->blocks())
- CurAST->add(*BB); // Incorporate the specified basic block
- };
for (Loop *InnerL : L->getSubLoops()) {
auto MapI = LoopToAliasSetMap.find(InnerL);
// If the AST for this inner loop is missing it may have been merged into
@@ -1566,10 +1561,13 @@ LoopInvariantCodeMotion::collectAliasInfoForLoop(Loop *L, LoopInfo *LI,
// Add everything from the sub loops that are no longer directly available.
for (Loop *InnerL : RecomputeLoops)
- mergeLoop(InnerL);
+ for (BasicBlock *BB : InnerL->blocks())
+ CurAST->add(*BB);
- // And merge in this loop.
- mergeLoop(L);
+ // And merge in this loop (without anything from inner loops).
+ for (BasicBlock *BB : L->blocks())
+ if (LI->getLoopFor(BB) == L)
+ CurAST->add(*BB);
return CurAST;
}
OpenPOWER on IntegriCloud