[PATCH] D24840: Search for all predecessors of loop header while getting loop metadata

Michael Zolotukhin via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 11 15:18:55 PDT 2016


mzolotukhin added inline comments.


================
Comment at: llvm/lib/Analysis/LoopInfo.cpp:215
+    for (BasicBlock *BB : predecessors(H)) {
       // Check if this terminator branches to the loop header.
+      if (!this->contains(BB))
----------------
This comment is stale now.


================
Comment at: llvm/lib/Analysis/LoopInfo.cpp:253
+    TI->setMetadata(LLVMContext::MD_loop, LoopID);
+    assert(!MDSet && "Multiple branches to loop header from within loop.");
+    MDSet = true;
----------------
Are you sure that we cannot have multiple branches? I think it's true for well-formed loops, but might be incorrect in a general case.


https://reviews.llvm.org/D24840





More information about the llvm-commits mailing list