mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-23 12:40:17 +00:00
code cleanup, no functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50201 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
c9e495c534
commit
f4023a1ef6
@ -1516,25 +1516,27 @@ bool SCCP::runOnFunction(Function &F) {
|
|||||||
//
|
//
|
||||||
for (BasicBlock::iterator BI = BB->begin(), E = BB->end(); BI != E; ) {
|
for (BasicBlock::iterator BI = BB->begin(), E = BB->end(); BI != E; ) {
|
||||||
Instruction *Inst = BI++;
|
Instruction *Inst = BI++;
|
||||||
if (Inst->getType() != Type::VoidTy) {
|
if (Inst->getType() == Type::VoidTy ||
|
||||||
LatticeVal &IV = Values[Inst];
|
isa<TerminatorInst>(Inst))
|
||||||
if ((IV.isConstant() || IV.isUndefined()) &&
|
continue;
|
||||||
!isa<TerminatorInst>(Inst)) {
|
|
||||||
Constant *Const = IV.isConstant()
|
LatticeVal &IV = Values[Inst];
|
||||||
? IV.getConstant() : UndefValue::get(Inst->getType());
|
if (!IV.isConstant() && !IV.isUndefined())
|
||||||
DOUT << " Constant: " << *Const << " = " << *Inst;
|
continue;
|
||||||
|
|
||||||
|
Constant *Const = IV.isConstant()
|
||||||
|
? IV.getConstant() : UndefValue::get(Inst->getType());
|
||||||
|
DOUT << " Constant: " << *Const << " = " << *Inst;
|
||||||
|
|
||||||
// Replaces all of the uses of a variable with uses of the constant.
|
// Replaces all of the uses of a variable with uses of the constant.
|
||||||
Inst->replaceAllUsesWith(Const);
|
Inst->replaceAllUsesWith(Const);
|
||||||
|
|
||||||
// Delete the instruction.
|
// Delete the instruction.
|
||||||
BB->getInstList().erase(Inst);
|
Inst->eraseFromParent();
|
||||||
|
|
||||||
// Hey, we just changed something!
|
// Hey, we just changed something!
|
||||||
MadeChanges = true;
|
MadeChanges = true;
|
||||||
++NumInstRemoved;
|
++NumInstRemoved;
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user