OSDN Git Service

Simplify pointer comparisons involving memory allocation functions
authorHal Finkel <hfinkel@anl.gov>
Mon, 1 Dec 2014 23:38:06 +0000 (23:38 +0000)
committerHal Finkel <hfinkel@anl.gov>
Mon, 1 Dec 2014 23:38:06 +0000 (23:38 +0000)
commit7e32aa1015b0553a486af05780235ae60ac2df21
tree25b35ca8b6d876ece4aa0ed2de9b170ad217bec5
parent0dfac4002b7cea3308019c138133ec96fd3e90d0
Simplify pointer comparisons involving memory allocation functions

System memory allocation functions, which are identified at the IR level by the
noalias attribute on the return value, must return a pointer into a memory region
disjoint from any other memory accessible to the caller. We can use this
property to simplify pointer comparisons between allocated memory and local
stack addresses and the addresses of global variables. Neither the stack nor
global variables can overlap with the region used by the memory allocator.

Fixes PR21556.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223093 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Analysis/InstructionSimplify.cpp
test/Transforms/InstSimplify/noalias-ptr.ll [new file with mode: 0644]