Fix bug: SimplifyCFG/2003-08-17-BranchFoldOrdering.ll
authorChris Lattner <sabre@nondot.org>
Sun, 17 Aug 2003 19:41:53 +0000 (19:41 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 17 Aug 2003 19:41:53 +0000 (19:41 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7921 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Utils/Local.cpp
lib/Transforms/Utils/SimplifyCFG.cpp

index d3778c504433d65b5606ac7842fb22a6e08d907f..3ea76c4ea51dae41bf86a2d75b6b7c83233f407a 100644 (file)
@@ -74,6 +74,12 @@ bool ConstantFoldTerminator(BasicBlock *BB) {
       BI->setUnconditionalDest(Dest1);
       return true;
     }
+  } else if (SwitchInst *SI = dyn_cast<SwitchInst>(TI)) {
+    if (ConstantInt *CI = dyn_cast<ConstantInt>(SI->getCondition())) {
+
+
+    }
+
   }
   return false;
 }
index 1adbef9253a041bf28a65159b7bdd7de604a350f..ed0d45be26b826a3d3d30fd17f7cdb28f002c134 100644 (file)
@@ -121,6 +121,10 @@ bool SimplifyCFG(BasicBlock *BB) {
     return true;
   }
 
+  // Check to see if we can constant propagate this terminator instruction
+  // away...
+  bool Changed = ConstantFoldTerminator(BB);
+
   // Check to see if this block has no non-phi instructions and only a single
   // successor.  If so, replace references to this basic block with references
   // to the successor.
@@ -251,5 +255,5 @@ bool SimplifyCFG(BasicBlock *BB) {
     }
   }
   
-  return false;
+  return Changed;
 }