[PATCH] D51715: [LICM] Avoid duplicate work during building AliasSetTracker

Serguei Katkov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 10 21:08:56 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL341896: [LICM] Avoid duplicate work during building AliasSetTracker (authored by skatkov, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D51715?vs=164356&id=164799#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D51715

Files:
  llvm/trunk/lib/Transforms/Scalar/LICM.cpp


Index: llvm/trunk/lib/Transforms/Scalar/LICM.cpp
===================================================================
--- llvm/trunk/lib/Transforms/Scalar/LICM.cpp
+++ llvm/trunk/lib/Transforms/Scalar/LICM.cpp
@@ -1535,11 +1535,6 @@
                                                  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 @@
 
   // 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;
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51715.164799.patch
Type: text/x-patch
Size: 1267 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180911/2e320979/attachment.bin>


More information about the llvm-commits mailing list