[PATCH] D66084: Remove assert in getLoopGuardBranch

Dangeti Tharun kumar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 12 05:23:27 PDT 2019


DTharun created this revision.
DTharun added a reviewer: Whitney.
DTharun added a project: LLVM.
Herald added a subscriber: llvm-commits.

The assertion in getLoopGuardBranch can be a 'return nullptr' under if condition.  'getInductionVariable' does the same thing.


Repository:
  rL LLVM

https://reviews.llvm.org/D66084

Files:
  lib/Analysis/LoopInfo.cpp


Index: lib/Analysis/LoopInfo.cpp
===================================================================
--- lib/Analysis/LoopInfo.cpp
+++ lib/Analysis/LoopInfo.cpp
@@ -360,7 +360,8 @@
 }
 
 BranchInst *Loop::getLoopGuardBranch() const {
-  assert(isLoopSimplifyForm() && "Only valid for loop in simplify form");
+  if (!isLoopSimplifyForm())
+    return nullptr;
   BasicBlock *Preheader = getLoopPreheader();
   BasicBlock *Latch = getLoopLatch();
   assert(Preheader && Latch &&


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66084.214607.patch
Type: text/x-patch
Size: 478 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190812/a0a4c939/attachment.bin>


More information about the llvm-commits mailing list