summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorVaivaswatha Nagaraj <vn@compilertree.com>2016-01-14 08:46:45 +0000
committerVaivaswatha Nagaraj <vn@compilertree.com>2016-01-14 08:46:45 +0000
commit68befd70942e981174ceec725745fa2d5bce973d (patch)
tree3becf340d7823e9ea1c5e297c402fbb69fbef889 /llvm/lib
parentfc96331d8801b16417a6eea38d89566efb998263 (diff)
downloadbcm5719-llvm-68befd70942e981174ceec725745fa2d5bce973d.tar.gz
bcm5719-llvm-68befd70942e981174ceec725745fa2d5bce973d.zip
[GlobalsAA] Relax condition in checking globals as args to functions
Summary: Since globals may escape as function arguments (even when they have been found to be non-escaping, because of optimizations such as memcpyoptimizer that replaces stores with memcpy), all arguments to a function are checked during query to make sure they are identifiable. At that time, also ensure we return a conservative result only if the arguments don't alias to our global. Reviewers: hfinkel, jmolloy Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D16140 llvm-svn: 257750
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Analysis/GlobalsModRef.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/GlobalsModRef.cpp b/llvm/lib/Analysis/GlobalsModRef.cpp
index 1babb822074..425d9de876b 100644
--- a/llvm/lib/Analysis/GlobalsModRef.cpp
+++ b/llvm/lib/Analysis/GlobalsModRef.cpp
@@ -863,7 +863,11 @@ ModRefInfo GlobalsAAResult::getModRefInfoForArgument(ImmutableCallSite CS,
GetUnderlyingObjects(A, Objects, DL);
// All objects must be identified.
- if (!std::all_of(Objects.begin(), Objects.end(), isIdentifiedObject))
+ if (!std::all_of(Objects.begin(), Objects.end(), isIdentifiedObject) &&
+ // Try ::alias to see if all objects are known not to alias GV.
+ !std::all_of(Objects.begin(), Objects.end(), [&](Value *V) {
+ return this->alias(MemoryLocation(V), MemoryLocation(GV)) == NoAlias;
+ }))
return ConservativeResult;
if (std::find(Objects.begin(), Objects.end(), GV) != Objects.end())
OpenPOWER on IntegriCloud