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

Chris Lattner lattner at cs.uiuc.edu
Thu Mar 17 12:17:11 PST 2005



Changes in directory llvm/lib/Analysis/DataStructure:

DataStructureAA.cpp updated: 1.24 -> 1.25
---
Log message:

simplify this function a bit, allow DS-AA to build on/improve the mod/ref
results returned by AA, not just use one or the other.


---
Diffs of the changes:  (+11 -8)

 DataStructureAA.cpp |   19 +++++++++++--------
 1 files changed, 11 insertions(+), 8 deletions(-)


Index: llvm/lib/Analysis/DataStructure/DataStructureAA.cpp
diff -u llvm/lib/Analysis/DataStructure/DataStructureAA.cpp:1.24 llvm/lib/Analysis/DataStructure/DataStructureAA.cpp:1.25
--- llvm/lib/Analysis/DataStructure/DataStructureAA.cpp:1.24	Thu Mar 17 13:56:18 2005
+++ llvm/lib/Analysis/DataStructure/DataStructureAA.cpp	Thu Mar 17 14:16:58 2005
@@ -173,9 +173,11 @@
 ///
 AliasAnalysis::ModRefResult
 DSAA::getModRefInfo(CallSite CS, Value *P, unsigned Size) {
+  AliasAnalysis::ModRefResult Result =AliasAnalysis::getModRefInfo(CS, P, Size);
   Function *F = CS.getCalledFunction();
-  if (!F || F->isExternal())
-    return AliasAnalysis::getModRefInfo(CS, P, Size);
+
+  if (!F || F->isExternal() || Result == NoModRef)
+    return Result;
 
   // Clone the function TD graph, clearing off Mod/Ref flags
   const Function *csParent = CS.getInstruction()->getParent()->getParent();
@@ -189,12 +191,13 @@
 
   // Report the flags that have been added
   const DSNodeHandle &DSH = TDGraph.getNodeForValue(P);
-  if (const DSNode *N = DSH.getNode())
-    if (N->isModified())
-      return N->isRead() ? ModRef : Mod;
-    else
-      return N->isRead() ? Ref : NoModRef;
-  return NoModRef;
+  if (const DSNode *N = DSH.getNode()) {
+    if (!N->isModified())   // We proved it was not modified.
+      Result = ModRefResult(Result & ~Mod);
+    if (!N->isRead())       // We proved it was not read.
+      Result = ModRefResult(Result & ~Ref);
+  }
+  return Result;
 }
 
 






More information about the llvm-commits mailing list