[PATCH] D46460: [LoopInfo] Don't bail out early in getLoopID

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 7 13:31:45 PDT 2018


fhahn added a comment.

Could you add a test for that? e.g in unittests/Analysis/LoopInfoTest.cpp



================
Comment at: lib/Analysis/LoopInfo.cpp:224
     BasicBlock *H = getHeader();
     for (BasicBlock *BB : this->blocks()) {
       TerminatorInst *TI = BB->getTerminator();
----------------
Shouldn't `getLoopLatches` return exactly the nodes we are interested in (predecessors of the header in the loop) [1]? IIUC using it would simplify the code even further.

[1] https://llvm.org/doxygen/classllvm_1_1LoopBase.html#abbefed3df8ce43cf3f0c2f7fd004f6a4


Repository:
  rL LLVM

https://reviews.llvm.org/D46460





More information about the llvm-commits mailing list