[PATCH] D37518: Fix PR33878: BasicAA incorrectly assumes different address spaces don't alias

Nuno Lopes via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 6 07:41:25 PDT 2017


nlopes created this revision.

This fixes http://llvm.org/PR33878
This code assumes that a nullptr of address space != 0 cannot alias with a non-null pointer.  This is incorrect, since nothing can be concluded about a null pointer in an address space != 0.
I trade down this code to revision r52299 (2008), before address spaces were introduced.


Repository:
  rL LLVM

https://reviews.llvm.org/D37518

Files:
  BasicAliasAnalysis.cpp


Index: BasicAliasAnalysis.cpp
===================================================================
--- BasicAliasAnalysis.cpp
+++ BasicAliasAnalysis.cpp
@@ -1590,11 +1590,6 @@
         (isa<Argument>(O2) && isIdentifiedFunctionLocal(O1)))
       return NoAlias;
 
-    // Most objects can't alias null.
-    if ((isa<ConstantPointerNull>(O2) && isKnownNonNull(O1)) ||
-        (isa<ConstantPointerNull>(O1) && isKnownNonNull(O2)))
-      return NoAlias;
-
     // If one pointer is the result of a call/invoke or load and the other is a
     // non-escaping local object within the same function, then we know the
     // object couldn't escape to a point where the call could return it.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D37518.114009.patch
Type: text/x-patch
Size: 687 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170906/bf4b2a2d/attachment.bin>


More information about the llvm-commits mailing list