summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2010-08-06 18:24:38 +0000
committerDan Gohman <gohman@apple.com>2010-08-06 18:24:38 +0000
commite68958fcdfb02296df153598c1610cefd915d51e (patch)
tree472946511f16ade3365f87abc2fed4fba9b43dea /llvm/lib/Analysis
parent0cb2c7a25ed5496febb619a90ad68c7b1857e733 (diff)
downloadbcm5719-llvm-e68958fcdfb02296df153598c1610cefd915d51e.tar.gz
bcm5719-llvm-e68958fcdfb02296df153598c1610cefd915d51e.zip
Implement a proper getModRefInfo for va_arg.
llvm-svn: 110458
Diffstat (limited to 'llvm/lib/Analysis')
-rw-r--r--llvm/lib/Analysis/AliasAnalysis.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/AliasAnalysis.cpp b/llvm/lib/Analysis/AliasAnalysis.cpp
index 0b15334e145..1f2528fa560 100644
--- a/llvm/lib/Analysis/AliasAnalysis.cpp
+++ b/llvm/lib/Analysis/AliasAnalysis.cpp
@@ -229,6 +229,23 @@ AliasAnalysis::getModRefInfo(const StoreInst *S, const Value *P, unsigned Size)
return Mod;
}
+AliasAnalysis::ModRefResult
+AliasAnalysis::getModRefInfo(const VAArgInst *V, const Value *P, unsigned Size) {
+ // If the va_arg address cannot alias the pointer in question, then the
+ // specified memory cannot be accessed by the va_arg.
+ if (!alias(V->getOperand(0), UnknownSize, P, Size))
+ return NoModRef;
+
+ // If the pointer is a pointer to constant memory, then it could not have been
+ // modified by this va_arg.
+ if (pointsToConstantMemory(P))
+ return NoModRef;
+
+ // Otherwise, a va_arg reads and writes.
+ return ModRef;
+}
+
+
AliasAnalysis::ModRefBehavior
AliasAnalysis::getIntrinsicModRefBehavior(unsigned iid) {
#define GET_INTRINSIC_MODREF_BEHAVIOR
OpenPOWER on IntegriCloud