diff options
author | Dan Gohman <gohman@apple.com> | 2010-08-06 18:24:38 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2010-08-06 18:24:38 +0000 |
commit | e68958fcdfb02296df153598c1610cefd915d51e (patch) | |
tree | 472946511f16ade3365f87abc2fed4fba9b43dea /llvm/lib/Analysis | |
parent | 0cb2c7a25ed5496febb619a90ad68c7b1857e733 (diff) | |
download | bcm5719-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.cpp | 17 |
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 |