[PATCH] D32261: [LoopUnroll] Don't try to unroll non-rotated loops

Davide Italiano via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 19 17:20:32 PDT 2017


davide added inline comments.


================
Comment at: lib/Transforms/Utils/LoopUnroll.cpp:338-348
+  // If the loop is not rotated the latch is not one of the exiting blocks.
+  // Bail out on non-rotated loops.
+  SmallVector<BasicBlock *, 8> ExitingBlocks;
+  L->getExitingBlocks(ExitingBlocks);
+  bool NotRotated =
+      llvm::all_of(ExitingBlocks, [&LatchBlock](const BasicBlock *BB) {
+        return LatchBlock != BB;
----------------
A similar check is done in LSR. Once we agree this is sufficient to handle these cases, maybe we can move the logic to a common file (`LoopInfo.h` maybe?)


https://reviews.llvm.org/D32261





More information about the llvm-commits mailing list