diff options
| author | Chris Lattner <sabre@nondot.org> | 2002-05-21 20:04:50 +0000 | 
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2002-05-21 20:04:50 +0000 | 
| commit | 4b009adc770ccadb5f249f9ece6d994a267ceb14 (patch) | |
| tree | 2f15bf5271c3944517ad9b7904a8820f832f2c80 | |
| parent | c18f65fdae68692c3a02e3d7b2d8f70c01ccfa69 (diff) | |
| download | bcm5719-llvm-4b009adc770ccadb5f249f9ece6d994a267ceb14.tar.gz bcm5719-llvm-4b009adc770ccadb5f249f9ece6d994a267ceb14.zip | |
Simplify interface to ConstantFoldTerminator
llvm-svn: 2697
| -rw-r--r-- | llvm/include/llvm/Transforms/Utils/Local.h | 3 | ||||
| -rw-r--r-- | llvm/lib/Transforms/Utils/Local.cpp | 6 | 
2 files changed, 4 insertions, 5 deletions
| diff --git a/llvm/include/llvm/Transforms/Utils/Local.h b/llvm/include/llvm/Transforms/Utils/Local.h index a01cd06a8d8..ed8bbdf3c32 100644 --- a/llvm/include/llvm/Transforms/Utils/Local.h +++ b/llvm/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/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp index 36622642bfa..eb06a5b1f92 100644 --- a/llvm/lib/Transforms/Utils/Local.cpp +++ b/llvm/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 | 

