Simplify interface to ConstantFoldTerminator

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2697 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2002-05-21 20:04:50 +00:00
parent b8bcb086f7
commit 76ae3445f8
2 changed files with 4 additions and 5 deletions

View File

@ -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);
//===----------------------------------------------------------------------===//

View File

@ -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