[PATCH] D76797: [LVI] Don't use dominator tree in isValidAssumeForContext()

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun May 17 12:47:28 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rG39beeeff205c: [LVI] Don't use dominator tree in isValidAssumeForContext() (authored by nikic).
Herald added a subscriber: hiraditya.

Changed prior to commit:
  https://reviews.llvm.org/D76797?vs=252650&id=264510#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D76797/new/

https://reviews.llvm.org/D76797

Files:
  llvm/lib/Analysis/LazyValueInfo.cpp


Index: llvm/lib/Analysis/LazyValueInfo.cpp
===================================================================
--- llvm/lib/Analysis/LazyValueInfo.cpp
+++ llvm/lib/Analysis/LazyValueInfo.cpp
@@ -802,11 +802,16 @@
   if (!BBI)
     return;
 
+  BasicBlock *BB = BBI->getParent();
   for (auto &AssumeVH : AC->assumptionsFor(Val)) {
     if (!AssumeVH)
       continue;
+
+    // Only check assumes in the block of the context instruction. Other
+    // assumes will have already been taken into account when the value was
+    // propagated from predecessor blocks.
     auto *I = cast<CallInst>(AssumeVH);
-    if (!isValidAssumeForContext(I, BBI, DT))
+    if (I->getParent() != BB || !isValidAssumeForContext(I, BBI))
       continue;
 
     BBLV = intersect(BBLV, getValueFromCondition(Val, I->getArgOperand(0)));
@@ -818,10 +823,10 @@
   if (!GuardDecl || GuardDecl->use_empty())
     return;
 
-  if (BBI->getIterator() == BBI->getParent()->begin())
+  if (BBI->getIterator() == BB->begin())
     return;
   for (Instruction &I : make_range(std::next(BBI->getIterator().getReverse()),
-                                   BBI->getParent()->rend())) {
+                                   BB->rend())) {
     Value *Cond = nullptr;
     if (match(&I, m_Intrinsic<Intrinsic::experimental_guard>(m_Value(Cond))))
       BBLV = intersect(BBLV, getValueFromCondition(Val, Cond));


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D76797.264510.patch
Type: text/x-patch
Size: 1378 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200517/c93b5f71/attachment.bin>


More information about the llvm-commits mailing list