From afd135197b23ae5a1bd03dba18e997099ea85448 Mon Sep 17 00:00:00 2001 From: Mehdi Amini Date: Thu, 5 Nov 2015 05:49:43 +0000 Subject: 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 llvm-svn: 252149 --- llvm/lib/Analysis/LoopAccessAnalysis.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'llvm/lib/Analysis/LoopAccessAnalysis.cpp') 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(UnderlyingObj)) + continue; + UnderlyingObjToAccessMap::iterator Prev = ObjToLastAccess.find(UnderlyingObj); if (Prev != ObjToLastAccess.end()) -- cgit v1.2.3