Fix an ugly problem in SCCP. This fixes Benchmarks/Misc-C++/mandel-text.cpp
authorChris Lattner <sabre@nondot.org>
Fri, 20 Oct 2006 20:19:08 +0000 (20:19 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 20 Oct 2006 20:19:08 +0000 (20:19 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31073 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/SCCP.cpp

index d1eb8dddda789aa06560c749ce597e09b0522f20..0397fc3bd895a4b519d979706bf41a6b9322fbed 100644 (file)
@@ -1032,7 +1032,7 @@ bool SCCPSolver::ResolveBranchesIn(Function &F) {
         if (BI->isConditional()) {
           LatticeVal &BCValue = getValueState(BI->getCondition());
           if (BCValue.isUndefined()) {
-            BI->setCondition(ConstantBool::getTrue());
+            BCValue.markOverdefined();
             BranchesResolved = true;
             visit(BI);
           }
@@ -1041,7 +1041,8 @@ bool SCCPSolver::ResolveBranchesIn(Function &F) {
         LatticeVal &SCValue = getValueState(SI->getCondition());
         if (SCValue.isUndefined()) {
           const Type *CondTy = SI->getCondition()->getType();
-          SI->setCondition(Constant::getNullValue(CondTy));
+          // Pick and arbitrary direction for the switch to go.
+          SCValue.markOverdefined();
           BranchesResolved = true;
           visit(SI);
         }