[PATCH] D28482: [loop-unroll] Properly populate LoopInfo for loops cloned in LoopUnrollRuntime.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 10 15:37:19 PST 2017


fhahn updated this revision to Diff 83885.
fhahn added a comment.

Thanks for the comments. I've committed the factoring out in https://reviews.llvm.org/rL291614 and will land the second commit from Phabricator.


https://reviews.llvm.org/D28482

Files:
  lib/Transforms/Utils/LoopUnrollRuntime.cpp


Index: lib/Transforms/Utils/LoopUnrollRuntime.cpp
===================================================================
--- lib/Transforms/Utils/LoopUnrollRuntime.cpp
+++ lib/Transforms/Utils/LoopUnrollRuntime.cpp
@@ -301,15 +301,17 @@
       LI->addTopLevelLoop(NewLoop);
   }
 
+  NewLoopsMap NewLoops;
+  NewLoops[L] = NewLoop;
   // For each block in the original loop, create a new copy,
   // and update the value map with the newly created values.
   for (LoopBlocksDFS::RPOIterator BB = BlockBegin; BB != BlockEnd; ++BB) {
     BasicBlock *NewBB = CloneBasicBlock(*BB, VMap, "." + suffix, F);
     NewBlocks.push_back(NewBB);
 
-    if (NewLoop)
-      NewLoop->addBasicBlockToLoop(NewBB, *LI);
-    else if (ParentLoop)
+    if (NewLoop) {
+      addClonedBlockToLoopInfo(*BB, NewBB, LI, NewLoops);
+    } else if (ParentLoop)
       ParentLoop->addBasicBlockToLoop(NewBB, *LI);
 
     VMap[*BB] = NewBB;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D28482.83885.patch
Type: text/x-patch
Size: 912 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170110/d44e8d48/attachment.bin>


More information about the llvm-commits mailing list