From fd4b3c477424dc934c27f7f39f91613e2021c9a5 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Wed, 15 Dec 2004 18:14:04 +0000 Subject: [PATCH] Eliminate a virtual method call git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18964 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Analysis/LoadValueNumbering.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/Analysis/LoadValueNumbering.cpp b/lib/Analysis/LoadValueNumbering.cpp index a8c9d5f231c..67d675f40bc 100644 --- a/lib/Analysis/LoadValueNumbering.cpp +++ b/lib/Analysis/LoadValueNumbering.cpp @@ -144,7 +144,10 @@ void LoadVN::getCallEqualNumberNodes(CallInst *CI, Function *CF = CI->getCalledFunction(); if (CF == 0) return; // Indirect call. AliasAnalysis &AA = getAnalysis(); - 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 // 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 // ANY memory. // - if (!AA.doesNotAccessMemory(CF)) { + if (MRB == AliasAnalysis::OnlyReadsMemory) { DominatorSet &DomSetInfo = getAnalysis(); BasicBlock *CIBB = CI->getParent(); for (unsigned i = 0; i != IdenticalCalls.size(); ++i) {