mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-23 02:32:11 +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,11 +1693,15 @@ bool IPSCCP::runOnModule(Module &M) {
|
||||
} else {
|
||||
for (BasicBlock::iterator BI = BB->begin(), E = BB->end(); BI != E; ) {
|
||||
Instruction *Inst = BI++;
|
||||
if (Inst->getType() != Type::VoidTy &&
|
||||
!isa<StructType>(Inst->getType())) {
|
||||
if (Inst->getType() == Type::VoidTy ||
|
||||
isa<StructType>(Inst->getType()) ||
|
||||
isa<TerminatorInst>(Inst))
|
||||
continue;
|
||||
|
||||
LatticeVal &IV = Values[Inst];
|
||||
if (IV.isConstant() ||
|
||||
(IV.isUndefined() && !isa<TerminatorInst>(Inst))) {
|
||||
if (!IV.isConstant() && !IV.isUndefined())
|
||||
continue;
|
||||
|
||||
Constant *Const = IV.isConstant()
|
||||
? IV.getConstant() : UndefValue::get(Inst->getType());
|
||||
DOUT << " Constant: " << *Const << " = " << *Inst;
|
||||
@ -1707,16 +1711,14 @@ bool IPSCCP::runOnModule(Module &M) {
|
||||
Inst->replaceAllUsesWith(Const);
|
||||
|
||||
// Delete the instruction.
|
||||
if (!isa<TerminatorInst>(Inst) && !isa<CallInst>(Inst))
|
||||
BB->getInstList().erase(Inst);
|
||||
if (!isa<CallInst>(Inst))
|
||||
Inst->eraseFromParent();
|
||||
|
||||
// Hey, we just changed something!
|
||||
MadeChanges = true;
|
||||
++IPNumInstRemoved;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Now that all instructions in the function are constant folded, erase dead
|
||||
// blocks, because we can now use ConstantFoldTerminator to get rid of
|
||||
|
Loading…
x
Reference in New Issue
Block a user