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

Chris Lattner lattner at cs.uiuc.edu
Fri Jan 30 16:17:02 PST 2004


Changes in directory llvm/lib/Analysis:

AliasAnalysis.cpp updated: 1.15 -> 1.16

---
Log message:

Improve mod/ref information based on the pointsToConstantMemory method.


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

Index: llvm/lib/Analysis/AliasAnalysis.cpp
diff -u llvm/lib/Analysis/AliasAnalysis.cpp:1.15 llvm/lib/Analysis/AliasAnalysis.cpp:1.16
--- llvm/lib/Analysis/AliasAnalysis.cpp:1.15	Tue Nov 11 16:41:31 2003
+++ llvm/lib/Analysis/AliasAnalysis.cpp	Fri Jan 30 16:16:42 2004
@@ -44,8 +44,15 @@
 
 AliasAnalysis::ModRefResult
 AliasAnalysis::getModRefInfo(StoreInst *S, Value *P, unsigned Size) {
-  return alias(S->getOperand(1), TD->getTypeSize(S->getOperand(0)->getType()),
-               P, Size) ? Mod : NoModRef;
+  // If the stored address cannot alias the pointer in question, then the
+  // pointer cannot be modified by the store.
+  if (!alias(S->getOperand(1), TD->getTypeSize(S->getOperand(0)->getType()),
+             P, Size))
+    return NoModRef;
+
+  // If the pointer is a pointer to constant memory, then it could not have been
+  // modified by this store.
+  return pointsToConstantMemory(P) ? NoModRef : Mod;
 }
 
 





More information about the llvm-commits mailing list