Dont' merge terminators that are needed to select PHI node values.
authorChris Lattner <sabre@nondot.org>
Sun, 2 May 2004 01:00:44 +0000 (01:00 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 2 May 2004 01:00:44 +0000 (01:00 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13312 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Utils/SimplifyCFG.cpp

index dedaa6a657c21132b0dc9ce0ec43c33737d2db5b..a1b917ff3e918b5724a9645c474df2ba4c0ab4d2 100644 (file)
@@ -812,7 +812,7 @@ bool llvm::SimplifyCFG(BasicBlock *BB) {
 
           for (pred_iterator PI = pred_begin(BB), E = pred_end(BB); PI!=E; ++PI)
             if (BranchInst *PBI = dyn_cast<BranchInst>((*PI)->getTerminator()))
-              if (PBI->isConditional()) {
+              if (PBI->isConditional() && SafeToMergeTerminators(BI, PBI)) {
                 if (PBI->getSuccessor(0) == FalseDest ||
                     PBI->getSuccessor(1) == TrueDest) {
                   // Invert the predecessors condition test (xor it with true),