aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-08-17 19:41:53 +0000
committerChris Lattner <sabre@nondot.org>2003-08-17 19:41:53 +0000
commit694e37f08a7c09ccc24642532106295cf7b3a1e3 (patch)
treeadb19b90f3b2a047d68d2c1ac53dccccc31d9845
parentf0cd835784daf390e730f1c4a9582ff0c517e57e (diff)
downloadexternal_llvm-694e37f08a7c09ccc24642532106295cf7b3a1e3.zip
external_llvm-694e37f08a7c09ccc24642532106295cf7b3a1e3.tar.gz
external_llvm-694e37f08a7c09ccc24642532106295cf7b3a1e3.tar.bz2
Fix bug: SimplifyCFG/2003-08-17-BranchFoldOrdering.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7921 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Transforms/Utils/Local.cpp6
-rw-r--r--lib/Transforms/Utils/SimplifyCFG.cpp6
2 files changed, 11 insertions, 1 deletions
diff --git a/lib/Transforms/Utils/Local.cpp b/lib/Transforms/Utils/Local.cpp
index d3778c5..3ea76c4 100644
--- a/lib/Transforms/Utils/Local.cpp
+++ b/lib/Transforms/Utils/Local.cpp
@@ -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;
}
diff --git a/lib/Transforms/Utils/SimplifyCFG.cpp b/lib/Transforms/Utils/SimplifyCFG.cpp
index 1adbef9..ed0d45b 100644
--- a/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -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;
}