[llvm-commits] [llvm] r151466 - in /llvm/trunk: include/llvm/Analysis/Dominators.h lib/Analysis/InstructionSimplify.cpp

Rafael Espindola rafael.espindola at gmail.com
Sat Feb 25 17:50:15 PST 2012


Author: rafael
Date: Sat Feb 25 19:50:14 2012
New Revision: 151466

URL: http://llvm.org/viewvc/llvm-project?rev=151466&view=rev
Log:
Don't call dominates on unreachable instructions.

Modified:
    llvm/trunk/include/llvm/Analysis/Dominators.h
    llvm/trunk/lib/Analysis/InstructionSimplify.cpp

Modified: llvm/trunk/include/llvm/Analysis/Dominators.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/Dominators.h?rev=151466&r1=151465&r2=151466&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/Dominators.h (original)
+++ llvm/trunk/include/llvm/Analysis/Dominators.h Sat Feb 25 19:50:14 2012
@@ -820,7 +820,7 @@
     DT->splitBlock(NewBB);
   }
 
-  bool isReachableFromEntry(const BasicBlock* A) {
+  bool isReachableFromEntry(const BasicBlock* A) const {
     return DT->isReachableFromEntry(A);
   }
 

Modified: llvm/trunk/lib/Analysis/InstructionSimplify.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/InstructionSimplify.cpp?rev=151466&r1=151465&r2=151466&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/InstructionSimplify.cpp (original)
+++ llvm/trunk/lib/Analysis/InstructionSimplify.cpp Sat Feb 25 19:50:14 2012
@@ -92,7 +92,8 @@
 
   // If we have a DominatorTree then do a precise test.
   if (DT)
-    return DT->dominates(I, P);
+    return !DT->isReachableFromEntry(P->getParent()) ||
+      !DT->isReachableFromEntry(I->getParent()) || DT->dominates(I, P);
 
   // Otherwise, if the instruction is in the entry block, and is not an invoke,
   // then it obviously dominates all phi nodes.





More information about the llvm-commits mailing list