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

Michael Kruse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 8 16:50:09 PDT 2019


Meinersbur added inline comments.


================
Comment at: llvm/include/llvm/Analysis/LoopInfo.h:763
+    BasicBlock *Latch = getLoopLatch();
+    assert(Latch && "Expecting valid latch block.");
+    return isLoopExiting(Latch);
----------------
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.


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


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