[PATCH] D61215: [LoopInfo] Faster implementation of setLoopID. NFC.

Phabricator via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 1 07:38:46 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL359684: [LoopInfo] Faster implementation of setLoopID. NFC. (authored by kfischer, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D61215?vs=196923&id=197550#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D61215

Files:
  llvm/trunk/lib/Analysis/LoopInfo.cpp


Index: llvm/trunk/lib/Analysis/LoopInfo.cpp
===================================================================
--- llvm/trunk/lib/Analysis/LoopInfo.cpp
+++ llvm/trunk/lib/Analysis/LoopInfo.cpp
@@ -254,16 +254,10 @@
   assert((!LoopID || LoopID->getOperand(0) == LoopID) &&
          "Loop ID should refer to itself");
 
-  BasicBlock *H = getHeader();
-  for (BasicBlock *BB : this->blocks()) {
-    Instruction *TI = BB->getTerminator();
-    for (BasicBlock *Successor : successors(TI)) {
-      if (Successor == H) {
-        TI->setMetadata(LLVMContext::MD_loop, LoopID);
-        break;
-      }
-    }
-  }
+  SmallVector<BasicBlock *, 4> LoopLatches;
+  getLoopLatches(LoopLatches);
+  for (BasicBlock *BB : LoopLatches)
+    BB->getTerminator()->setMetadata(LLVMContext::MD_loop, LoopID);
 }
 
 void Loop::setLoopAlreadyUnrolled() {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61215.197550.patch
Type: text/x-patch
Size: 842 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190501/b29f6fa5/attachment.bin>


More information about the llvm-commits mailing list