ValueTracking: Fix isKnownNonZero for non-0 null pointers for byval
authorMatt Arsenault <Matthew.Arsenault@amd.com>
Thu, 25 Jun 2020 23:12:55 +0000 (19:12 -0400)
committerMatt Arsenault <Matthew.Arsenault@amd.com>
Thu, 16 Jul 2020 17:50:49 +0000 (13:50 -0400)
commit0347039a6e7daa774d016e0a4e0f2568c7913351
treef041a25b867d6c636e4a02b94c4ad75a8e788ba6
parentb16dfbead21a458799a0dab96599eb15f5d9b7ea
ValueTracking: Fix isKnownNonZero for non-0 null pointers for byval

The IR doesn't have a proper concept of invalid pointers, and "null"
constants are just all zeros (though it really needs one).

I think it's not possible to break this for AMDGPU due to the copy
semantics of byval. If you have an original stack object at 0, the
byval copy will be placed above it so I don't think it's really
possible to hit a 0 address.
llvm/lib/Analysis/ValueTracking.cpp
llvm/test/Transforms/InstSimplify/null-ptr-is-valid-attribute.ll [new file with mode: 0644]
llvm/test/Transforms/InstSimplify/null-ptr-is-valid.ll [new file with mode: 0644]