mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-28 06:32:09 +00:00
Small improvement: if a function doesn't access memory, we don't need to scan
it for potentially undeading pointers. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40933 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
bb3abf41a8
commit
df359c264e
@ -287,6 +287,13 @@ bool DSE::handleEndBlock(BasicBlock& BB,
|
|||||||
deadPointers.erase(A);
|
deadPointers.erase(A);
|
||||||
continue;
|
continue;
|
||||||
} else if (CallSite::get(BBI).getInstruction() != 0) {
|
} else if (CallSite::get(BBI).getInstruction() != 0) {
|
||||||
|
// If this call does not access memory, it can't
|
||||||
|
// be undeadifying any of our pointers.
|
||||||
|
CallSite CS = CallSite::get(BBI);
|
||||||
|
if (CS.getCalledFunction() &&
|
||||||
|
AA.doesNotAccessMemory(CS.getCalledFunction()))
|
||||||
|
continue;
|
||||||
|
|
||||||
// Remove any pointers made undead by the call from the dead set
|
// Remove any pointers made undead by the call from the dead set
|
||||||
std::vector<Instruction*> dead;
|
std::vector<Instruction*> dead;
|
||||||
for (SmallPtrSet<AllocaInst*, 64>::iterator I = deadPointers.begin(),
|
for (SmallPtrSet<AllocaInst*, 64>::iterator I = deadPointers.begin(),
|
||||||
@ -298,8 +305,7 @@ bool DSE::handleEndBlock(BasicBlock& BB,
|
|||||||
TD.getTypeSize((*I)->getAllocatedType());
|
TD.getTypeSize((*I)->getAllocatedType());
|
||||||
|
|
||||||
// See if the call site touches it
|
// See if the call site touches it
|
||||||
AliasAnalysis::ModRefResult A = AA.getModRefInfo(CallSite::get(BBI),
|
AliasAnalysis::ModRefResult A = AA.getModRefInfo(CS, *I, pointerSize);
|
||||||
*I, pointerSize);
|
|
||||||
if (A == AliasAnalysis::ModRef || A == AliasAnalysis::Ref)
|
if (A == AliasAnalysis::ModRef || A == AliasAnalysis::Ref)
|
||||||
dead.push_back(*I);
|
dead.push_back(*I);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user