summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis
diff options
context:
space:
mode:
authorArtur Pilipenko <apilipenko@azulsystems.com>2016-10-21 15:02:21 +0000
committerArtur Pilipenko <apilipenko@azulsystems.com>2016-10-21 15:02:21 +0000
commit47dc098c0665931bbd885c40b2f596697b1b54c9 (patch)
treeab3652947f49ab63dc4f57374ba2345c67b9e996 /llvm/lib/Analysis
parent501be9b3d7eff577e2eef89f330e5f4ff01fe9d7 (diff)
downloadbcm5719-llvm-47dc098c0665931bbd885c40b2f596697b1b54c9.tar.gz
bcm5719-llvm-47dc098c0665931bbd885c40b2f596697b1b54c9.zip
[LVI] Fix a bug with a guard being the very first instruction in a BB not taken into account
While looking for guards use reverse iterator and scan up to rend() not to begin() llvm-svn: 284827
Diffstat (limited to 'llvm/lib/Analysis')
-rw-r--r--llvm/lib/Analysis/LazyValueInfo.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/llvm/lib/Analysis/LazyValueInfo.cpp b/llvm/lib/Analysis/LazyValueInfo.cpp
index 880adacdc5a..c3329d19115 100644
--- a/llvm/lib/Analysis/LazyValueInfo.cpp
+++ b/llvm/lib/Analysis/LazyValueInfo.cpp
@@ -978,12 +978,11 @@ void LazyValueInfoImpl::intersectAssumeOrGuardBlockValueConstantRange(
if (!GuardDecl || GuardDecl->use_empty())
return;
- for (BasicBlock::iterator I = BBI->getIterator(),
- E = BBI->getParent()->begin(); I != E; I--) {
+ for (Instruction &I : make_range(BBI->getIterator().getReverse(),
+ BBI->getParent()->rend())) {
Value *Cond = nullptr;
- if (!match(&*I, m_Intrinsic<Intrinsic::experimental_guard>(m_Value(Cond))))
- continue;
- BBLV = intersect(BBLV, getValueFromCondition(Val, Cond));
+ if (match(&I, m_Intrinsic<Intrinsic::experimental_guard>(m_Value(Cond))))
+ BBLV = intersect(BBLV, getValueFromCondition(Val, Cond));
}
}
OpenPOWER on IntegriCloud