summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis
diff options
context:
space:
mode:
authorMehdi Amini <mehdi.amini@apple.com>2015-11-05 05:49:43 +0000
committerMehdi Amini <mehdi.amini@apple.com>2015-11-05 05:49:43 +0000
commitafd135197b23ae5a1bd03dba18e997099ea85448 (patch)
treeb359cd4d560212ba5cc43e9624db7afc411ffe56 /llvm/lib/Analysis
parent69f10b4e309469df37738720541b32fb4e32dc71 (diff)
downloadbcm5719-llvm-afd135197b23ae5a1bd03dba18e997099ea85448.tar.gz
bcm5719-llvm-afd135197b23ae5a1bd03dba18e997099ea85448.zip
Fix LoopAccessAnalysis when potentially nullptr check are involved
Summary: GetUnderlyingObjects() can return "null" among its list of objects, we don't want to deduce that two pointers can point to the same memory in this case, so filter it out. Reviewers: anemet Subscribers: dexonsmith, llvm-commits From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 252149
Diffstat (limited to 'llvm/lib/Analysis')
-rw-r--r--llvm/lib/Analysis/LoopAccessAnalysis.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/LoopAccessAnalysis.cpp b/llvm/lib/Analysis/LoopAccessAnalysis.cpp
index 58a7d08860b..49b28078c97 100644
--- a/llvm/lib/Analysis/LoopAccessAnalysis.cpp
+++ b/llvm/lib/Analysis/LoopAccessAnalysis.cpp
@@ -268,7 +268,7 @@ void RuntimePointerChecking::groupChecks(
// ShouldRetryWithRuntimeCheck is set, and therefore UseDependencies
// is also false. In this case we will use the fallback path and create
// separate checking groups for all pointers.
-
+
// If we don't have the dependency partitions, construct a new
// checking pointer group for each pointer. This is also required
// for correctness, because in this case we can have checking between
@@ -743,6 +743,11 @@ void AccessAnalysis::processMemAccesses() {
GetUnderlyingObjects(Ptr, TempObjects, DL, LI);
DEBUG(dbgs() << "Underlying objects for pointer " << *Ptr << "\n");
for (Value *UnderlyingObj : TempObjects) {
+ // nullptr never alias, don't join sets for pointer that have "null"
+ // in their UnderlyingObjects list.
+ if (isa<ConstantPointerNull>(UnderlyingObj))
+ continue;
+
UnderlyingObjToAccessMap::iterator Prev =
ObjToLastAccess.find(UnderlyingObj);
if (Prev != ObjToLastAccess.end())
OpenPOWER on IntegriCloud