summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/AliasAnalysis.cpp
diff options
context:
space:
mode:
authorDaniel Berlin <dberlin@dberlin.org>2015-04-28 19:19:14 +0000
committerDaniel Berlin <dberlin@dberlin.org>2015-04-28 19:19:14 +0000
commitec1de3fb19d91426d6c812f47a3b1a59b19ee7f6 (patch)
tree49a880cdfd17b186cea4bd49ad9b051cc059d918 /llvm/lib/Analysis/AliasAnalysis.cpp
parent163f672cd535fb21ea8bac2d38e699157fb2cf15 (diff)
downloadbcm5719-llvm-ec1de3fb19d91426d6c812f47a3b1a59b19ee7f6.tar.gz
bcm5719-llvm-ec1de3fb19d91426d6c812f47a3b1a59b19ee7f6.zip
Make getModRefInfo(Instruction *) not crash on certain types of instructions
llvm-svn: 236023
Diffstat (limited to 'llvm/lib/Analysis/AliasAnalysis.cpp')
-rw-r--r--llvm/lib/Analysis/AliasAnalysis.cpp23
1 files changed, 13 insertions, 10 deletions
diff --git a/llvm/lib/Analysis/AliasAnalysis.cpp b/llvm/lib/Analysis/AliasAnalysis.cpp
index 43db1763bbb..1ee60ff1a30 100644
--- a/llvm/lib/Analysis/AliasAnalysis.cpp
+++ b/llvm/lib/Analysis/AliasAnalysis.cpp
@@ -379,15 +379,18 @@ AliasAnalysis::getModRefInfo(const StoreInst *S, const Location &Loc) {
AliasAnalysis::ModRefResult
AliasAnalysis::getModRefInfo(const VAArgInst *V, const Location &Loc) {
- // If the va_arg address cannot alias the pointer in question, then the
- // specified memory cannot be accessed by the va_arg.
- if (!alias(getLocation(V), Loc))
- return NoModRef;
- // If the pointer is a pointer to constant memory, then it could not have been
- // modified by this va_arg.
- if (pointsToConstantMemory(Loc))
- return NoModRef;
+ if (Loc.Ptr) {
+ // If the va_arg address cannot alias the pointer in question, then the
+ // specified memory cannot be accessed by the va_arg.
+ if (!alias(getLocation(V), Loc))
+ return NoModRef;
+
+ // If the pointer is a pointer to constant memory, then it could not have
+ // been modified by this va_arg.
+ if (pointsToConstantMemory(Loc))
+ return NoModRef;
+ }
// Otherwise, a va_arg reads and writes.
return ModRef;
@@ -400,7 +403,7 @@ AliasAnalysis::getModRefInfo(const AtomicCmpXchgInst *CX, const Location &Loc) {
return ModRef;
// If the cmpxchg address does not alias the location, it does not access it.
- if (!alias(getLocation(CX), Loc))
+ if (Loc.Ptr && !alias(getLocation(CX), Loc))
return NoModRef;
return ModRef;
@@ -413,7 +416,7 @@ AliasAnalysis::getModRefInfo(const AtomicRMWInst *RMW, const Location &Loc) {
return ModRef;
// If the atomicrmw address does not alias the location, it does not access it.
- if (!alias(getLocation(RMW), Loc))
+ if (Loc.Ptr && !alias(getLocation(RMW), Loc))
return NoModRef;
return ModRef;
OpenPOWER on IntegriCloud