mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-08 03:30:22 +00:00
code restructuring, not functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50203 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
7cb22ecf22
commit
eb5f4092d9
@ -1693,28 +1693,30 @@ bool IPSCCP::runOnModule(Module &M) {
|
|||||||
} else {
|
} else {
|
||||||
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 ||
|
||||||
!isa<StructType>(Inst->getType())) {
|
isa<StructType>(Inst->getType()) ||
|
||||||
LatticeVal &IV = Values[Inst];
|
isa<TerminatorInst>(Inst))
|
||||||
if (IV.isConstant() ||
|
continue;
|
||||||
(IV.isUndefined() && !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
|
// Replaces all of the uses of a variable with uses of the
|
||||||
// constant.
|
// constant.
|
||||||
Inst->replaceAllUsesWith(Const);
|
Inst->replaceAllUsesWith(Const);
|
||||||
|
|
||||||
|
// Delete the instruction.
|
||||||
|
if (!isa<CallInst>(Inst))
|
||||||
|
Inst->eraseFromParent();
|
||||||
|
|
||||||
// Delete the instruction.
|
// Hey, we just changed something!
|
||||||
if (!isa<TerminatorInst>(Inst) && !isa<CallInst>(Inst))
|
MadeChanges = true;
|
||||||
BB->getInstList().erase(Inst);
|
++IPNumInstRemoved;
|
||||||
|
|
||||||
// Hey, we just changed something!
|
|
||||||
MadeChanges = true;
|
|
||||||
++IPNumInstRemoved;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user