From 101915cfdaba9284b5bb8dedbbca2b7788f68da4 Mon Sep 17 00:00:00 2001 From: Philip Reames Date: Thu, 6 Jun 2019 18:02:36 +0000 Subject: [LoopPred] Fix a bug in unconditional latch bailout introduced in r362284 This is a really silly bug that even a simple test w/an unconditional latch would have caught. I tried to guard against the case, but put it in the wrong if check. Oops. llvm-svn: 362727 --- llvm/lib/Transforms/Scalar/LoopPredication.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'llvm/lib/Transforms') diff --git a/llvm/lib/Transforms/Scalar/LoopPredication.cpp b/llvm/lib/Transforms/Scalar/LoopPredication.cpp index 017bf21d233..ed715d36984 100644 --- a/llvm/lib/Transforms/Scalar/LoopPredication.cpp +++ b/llvm/lib/Transforms/Scalar/LoopPredication.cpp @@ -850,7 +850,7 @@ Optional LoopPredication::parseLoopLatchICmp() { } auto *BI = dyn_cast(LoopLatch->getTerminator()); - if (!BI) { + if (!BI || !BI->isConditional()) { LLVM_DEBUG(dbgs() << "Failed to match the latch terminator!\n"); return None; } @@ -860,7 +860,7 @@ Optional LoopPredication::parseLoopLatchICmp() { "One of the latch's destinations must be the header"); auto *ICI = dyn_cast(BI->getCondition()); - if (!ICI || !BI->isConditional()) { + if (!ICI) { LLVM_DEBUG(dbgs() << "Failed to match the latch condition!\n"); return None; } -- cgit v1.2.3