aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-05-21 20:04:50 +0000
committerChris Lattner <sabre@nondot.org>2002-05-21 20:04:50 +0000
commit76ae3445f81164aaff9f95123426109c119f27c0 (patch)
treeafc0553f492bf1b19f2a2f5269ecdc1223907a63
parentb8bcb086f7d4a74c40661c5c18134533a3f69fc9 (diff)
downloadexternal_llvm-76ae3445f81164aaff9f95123426109c119f27c0.zip
external_llvm-76ae3445f81164aaff9f95123426109c119f27c0.tar.gz
external_llvm-76ae3445f81164aaff9f95123426109c119f27c0.tar.bz2
Simplify interface to ConstantFoldTerminator
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2697 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/Transforms/Utils/Local.h3
-rw-r--r--lib/Transforms/Utils/Local.cpp6
2 files changed, 4 insertions, 5 deletions
diff --git a/include/llvm/Transforms/Utils/Local.h b/include/llvm/Transforms/Utils/Local.h
index a01cd06..ed8bbdf 100644
--- a/include/llvm/Transforms/Utils/Local.h
+++ b/include/llvm/Transforms/Utils/Local.h
@@ -25,8 +25,7 @@ bool doConstantPropogation(BasicBlock *BB, BasicBlock::iterator &I);
// destination. This is a nontrivial operation because the successors of this
// basic block must have their PHI nodes updated.
//
-bool ConstantFoldTerminator(BasicBlock *BB, BasicBlock::iterator &I,
- TerminatorInst *T);
+bool ConstantFoldTerminator(BasicBlock *BB);
//===----------------------------------------------------------------------===//
diff --git a/lib/Transforms/Utils/Local.cpp b/lib/Transforms/Utils/Local.cpp
index 3662264..eb06a5b 100644
--- a/lib/Transforms/Utils/Local.cpp
+++ b/lib/Transforms/Utils/Local.cpp
@@ -34,8 +34,9 @@ bool doConstantPropogation(BasicBlock *BB, BasicBlock::iterator &II) {
// constant value, convert it into an unconditional branch to the constant
// destination.
//
-bool ConstantFoldTerminator(BasicBlock *BB, BasicBlock::iterator &II,
- TerminatorInst *T) {
+bool ConstantFoldTerminator(BasicBlock *BB) {
+ TerminatorInst *T = BB->getTerminator();
+
// Branch - See if we are conditional jumping on constant
if (BranchInst *BI = dyn_cast<BranchInst>(T)) {
if (BI->isUnconditional()) return false; // Can't optimize uncond branch
@@ -60,7 +61,6 @@ bool ConstantFoldTerminator(BasicBlock *BB, BasicBlock::iterator &II,
// Set the unconditional destination, and change the insn to be an
// unconditional branch.
BI->setUnconditionalDest(Destination);
- II = BB->end()-1; // Update instruction iterator!
return true;
}
#if 0