OSDN Git Service

Move break-crit-edges before the predicate simplifier. Allows us to
authorNick Lewycky <nicholas@mxc.ca>
Tue, 3 Oct 2006 14:52:23 +0000 (14:52 +0000)
committerNick Lewycky <nicholas@mxc.ca>
Tue, 3 Oct 2006 14:52:23 +0000 (14:52 +0000)
optimize in more cases.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30699 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/PredicateSimplifier.cpp
test/Transforms/PredicateSimplifier/2006-09-20-SetCC.ll

index 715818c..b6de61b 100644 (file)
@@ -500,8 +500,10 @@ bool PredicateSimplifier::runOnFunction(Function &F) {
 }
 
 void PredicateSimplifier::getAnalysisUsage(AnalysisUsage &AU) const {
+  AU.addRequiredID(BreakCriticalEdgesID);
   AU.addRequired<DominatorTree>();
   AU.setPreservesCFG();
+  AU.addPreservedID(BreakCriticalEdgesID);
 }
 
 // resolve catches cases addProperty won't because it wasn't used as a
@@ -622,13 +624,7 @@ void PredicateSimplifier::proceedToSuccessor(TerminatorInst *TI,
                                              PropertySet &NextPS) {
   assert(edge < TI->getNumSuccessors() && "Invalid index for edge.");
 
-  BasicBlock *BB     = TI->getParent(),
-             *BBNext = TI->getSuccessor(edge);
-
-  if (BBNext->getSinglePredecessor() == BB)
-    visitBasicBlock(BBNext, NextPS);
-  else
-    visitBasicBlock(BBNext, CurrentPS);
+  visitBasicBlock(TI->getSuccessor(edge), NextPS);
 }
 
 void PredicateSimplifier::proceedToSuccessors(PropertySet &KP,
index b2462f9..67bc715 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | opt -predsimplify | llvm-dis | grep br | grep bb8 | grep cond_true$ | grep false
+; RUN: llvm-as < %s | opt -predsimplify | llvm-dis | grep br | grep return.i.bb8_crit_edge | grep false
 
 %str = external global [4 x sbyte]             ; <[4 x sbyte]*> [#uses=1]