[llvm-commits] CVS: llvm/lib/Analysis/LoadValueNumbering.cpp

Chris Lattner lattner at cs.uiuc.edu
Wed Dec 15 10:14:19 PST 2004



Changes in directory llvm/lib/Analysis:

LoadValueNumbering.cpp updated: 1.22 -> 1.23
---
Log message:

Eliminate a virtual method call


---
Diffs of the changes:  (+5 -2)

Index: llvm/lib/Analysis/LoadValueNumbering.cpp
diff -u llvm/lib/Analysis/LoadValueNumbering.cpp:1.22 llvm/lib/Analysis/LoadValueNumbering.cpp:1.23
--- llvm/lib/Analysis/LoadValueNumbering.cpp:1.22	Fri Sep  3 13:19:51 2004
+++ llvm/lib/Analysis/LoadValueNumbering.cpp	Wed Dec 15 12:14:04 2004
@@ -144,7 +144,10 @@
   Function *CF = CI->getCalledFunction();
   if (CF == 0) return;  // Indirect call.
   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
   // global.  In particular, we would prefer to have an argument or instruction
@@ -193,7 +196,7 @@
   // whether an intervening instruction could modify memory that is read, not
   // ANY memory.
   //
-  if (!AA.doesNotAccessMemory(CF)) {
+  if (MRB == AliasAnalysis::OnlyReadsMemory) {
     DominatorSet &DomSetInfo = getAnalysis<DominatorSet>();
     BasicBlock *CIBB = CI->getParent();
     for (unsigned i = 0; i != IdenticalCalls.size(); ++i) {






More information about the llvm-commits mailing list