[PATCH] D65958: [Loop] Add isRotated method to Loop class.

Kit Barton via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 3 11:29:06 PST 2019


kbarton marked 4 inline comments as done.
kbarton added inline comments.


================
Comment at: llvm/include/llvm/Analysis/LoopInfo.h:763
+    BasicBlock *Latch = getLoopLatch();
+    assert(Latch && "Expecting valid latch block.");
+    return isLoopExiting(Latch);
----------------
Meinersbur wrote:
> I think it would be simpler if the function would return `false` if there are multiple latches with the meaning that the loop is not in loop-rotated normal form.
> 
> Note that there might still be multiple exiting edges, e.g. if the latch's terminator is a switch.
> 
> I can also think a definition for rotated with multiple latches: All latches' outgoing edges that are not backedges are existing (so the property is orthogonal to simplified form), but this would probably not be useful for anything.
I agree - I think this makes sense. 


================
Comment at: llvm/unittests/Analysis/LoopInfoTest.cpp:1214
     EXPECT_TRUE(Exits.size() == 1);
   });
 }
----------------
Meinersbur wrote:
> [suggestion] ` EXPECT_FALSE(L->isRotated())` to have a negative test as well.
Added LoopNotRotated test. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D65958





More information about the llvm-commits mailing list