mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-05-29 22:39:31 +00:00
Eliminate a virtual method call
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18964 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
264ccbef75
commit
fd4b3c4774
@ -144,7 +144,10 @@ void LoadVN::getCallEqualNumberNodes(CallInst *CI,
|
|||||||
Function *CF = CI->getCalledFunction();
|
Function *CF = CI->getCalledFunction();
|
||||||
if (CF == 0) return; // Indirect call.
|
if (CF == 0) return; // Indirect call.
|
||||||
AliasAnalysis &AA = getAnalysis<AliasAnalysis>();
|
AliasAnalysis &AA = getAnalysis<AliasAnalysis>();
|
||||||
if (!AA.onlyReadsMemory(CF)) return; // Nothing we can do.
|
AliasAnalysis::ModRefBehavior MRB = AA.getModRefBehavior(CF, CI);
|
||||||
|
if (MRB != AliasAnalysis::DoesNotAccessMemory &&
|
||||||
|
MRB != AliasAnalysis::OnlyReadsMemory)
|
||||||
|
return; // Nothing we can do for now.
|
||||||
|
|
||||||
// Scan all of the arguments of the function, looking for one that is not
|
// Scan all of the arguments of the function, looking for one that is not
|
||||||
// global. In particular, we would prefer to have an argument or instruction
|
// global. In particular, we would prefer to have an argument or instruction
|
||||||
@ -193,7 +196,7 @@ void LoadVN::getCallEqualNumberNodes(CallInst *CI,
|
|||||||
// whether an intervening instruction could modify memory that is read, not
|
// whether an intervening instruction could modify memory that is read, not
|
||||||
// ANY memory.
|
// ANY memory.
|
||||||
//
|
//
|
||||||
if (!AA.doesNotAccessMemory(CF)) {
|
if (MRB == AliasAnalysis::OnlyReadsMemory) {
|
||||||
DominatorSet &DomSetInfo = getAnalysis<DominatorSet>();
|
DominatorSet &DomSetInfo = getAnalysis<DominatorSet>();
|
||||||
BasicBlock *CIBB = CI->getParent();
|
BasicBlock *CIBB = CI->getParent();
|
||||||
for (unsigned i = 0; i != IdenticalCalls.size(); ++i) {
|
for (unsigned i = 0; i != IdenticalCalls.size(); ++i) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user