[PATCH] D56848: [LCSSA] Skip blocks in sub-loops when scanning for uses.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 18 09:40:23 PST 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL351567: [LCSSA] Skip blocks in sub-loops when scanning for uses. (authored by fhahn, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D56848?vs=182381&id=182543#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56848/new/

https://reviews.llvm.org/D56848

Files:
  llvm/trunk/include/llvm/Transforms/Utils/LoopUtils.h
  llvm/trunk/lib/Transforms/Utils/LCSSA.cpp


Index: llvm/trunk/lib/Transforms/Utils/LCSSA.cpp
===================================================================
--- llvm/trunk/lib/Transforms/Utils/LCSSA.cpp
+++ llvm/trunk/lib/Transforms/Utils/LCSSA.cpp
@@ -325,6 +325,10 @@
   // Look at all the instructions in the loop, checking to see if they have uses
   // outside the loop.  If so, put them into the worklist to rewrite those uses.
   for (BasicBlock *BB : BlocksDominatingExits) {
+    // Skip blocks that are part of any sub-loops, they must be in LCSSA
+    // already.
+    if (LI->getLoopFor(BB) != &L)
+      continue;
     for (Instruction &I : *BB) {
       // Reject two common cases fast: instructions with no uses (like stores)
       // and instructions with one use that is in the same block as this.
Index: llvm/trunk/include/llvm/Transforms/Utils/LoopUtils.h
===================================================================
--- llvm/trunk/include/llvm/Transforms/Utils/LoopUtils.h
+++ llvm/trunk/include/llvm/Transforms/Utils/LoopUtils.h
@@ -79,7 +79,8 @@
 ///
 /// Looks at all instructions in the loop which have uses outside of the
 /// current loop. For each, an LCSSA PHI node is inserted and the uses outside
-/// the loop are rewritten to use this node.
+/// the loop are rewritten to use this node. Sub-loops must be in LCSSA form
+/// already.
 ///
 /// LoopInfo and DominatorTree are required and preserved.
 ///


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D56848.182543.patch
Type: text/x-patch
Size: 1403 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190118/55ad18c2/attachment.bin>


More information about the llvm-commits mailing list