*** empty log message ***

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2777 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2002-06-25 16:12:52 +00:00
parent a2204e1ff2
commit 18961504fc
43 changed files with 650 additions and 682 deletions

View File

@ -17,13 +17,12 @@
// them together...
//
bool doConstantPropogation(BasicBlock::iterator &II) {
Instruction *Inst = *II;
if (Constant *C = ConstantFoldInstruction(Inst)) {
if (Constant *C = ConstantFoldInstruction(II)) {
// Replaces all of the uses of a variable with uses of the constant.
Inst->replaceAllUsesWith(C);
II->replaceAllUsesWith(C);
// Remove the instruction from the basic block...
delete Inst->getParent()->getInstList().remove(II);
II = II->getParent()->getInstList().erase(II);
return true;
}
@ -102,9 +101,8 @@ bool isInstructionTriviallyDead(Instruction *I) {
//
bool dceInstruction(BasicBlock::iterator &BBI) {
// Look for un"used" definitions...
Instruction *I = *BBI;
if (isInstructionTriviallyDead(I)) {
delete I->getParent()->getInstList().remove(BBI); // Bye bye
if (isInstructionTriviallyDead(BBI)) {
BBI = BBI->getParent()->getInstList().erase(BBI); // Bye bye
return true;
}
return false;