[PATCH] D66529: [LOOPGUARD] Disable loop with multiple loop exiting blocks.

Whitney Tsang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 21 06:27:21 PDT 2019


Whitney created this revision.
Whitney added reviewers: reames, Meinersbur, kbarton, etiotto, bmahjour.
Whitney added a project: LLVM.
Herald added subscribers: llvm-commits, hiraditya.

As discussed in the loop group meeting. With the current definition of loop guard, we should not allow multiple loop exiting blocks. For loops that has multiple loop exiting blocks, we can simply unable to find the loop guard.


Repository:
  rL LLVM

https://reviews.llvm.org/D66529

Files:
  llvm/lib/Analysis/LoopInfo.cpp


Index: llvm/lib/Analysis/LoopInfo.cpp
===================================================================
--- llvm/lib/Analysis/LoopInfo.cpp
+++ llvm/lib/Analysis/LoopInfo.cpp
@@ -367,6 +367,10 @@
          "Expecting a loop with valid preheader and latch");
   assert(isLoopExiting(Latch) && "Only valid for rotated loop");
 
+  BasicBlock *Exiting = getExitingBlock();
+  if (!Exiting)
+    return nullptr;
+
   Instruction *LatchTI = Latch->getTerminator();
   if (!LatchTI || LatchTI->getNumSuccessors() != 2)
     return nullptr;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66529.216381.patch
Type: text/x-patch
Size: 535 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190821/e565a932/attachment.bin>


More information about the llvm-commits mailing list