Fix known zero bits for addrspacecast.
authorYaxun Liu <Yaxun.Liu@amd.com>
Mon, 21 Nov 2016 15:42:31 +0000 (15:42 +0000)
committerYaxun Liu <Yaxun.Liu@amd.com>
Mon, 21 Nov 2016 15:42:31 +0000 (15:42 +0000)
commit02f75f31e0e49fc35a6dc107b0b892e15fdcc3d3
tree5df2086d08f8d5d3dcfd9c7cc3eaa92c26083d6c
parent87eb9667bf81a0cb713a5910585cf6043ae96b71
Fix known zero bits for addrspacecast.

Currently LLVM assumes that a pointer addrspacecasted to a different addr space is equivalent to trunc or zext bitwise, which is not true. For example, in amdgcn target, when a null pointer is addrspacecasted from addr space 4 to 0, its value is changed from i64 0 to i32 -1.

This patch teaches LLVM not to assume known bits of addrspacecast instruction to its operand.

Differential Revision: https://reviews.llvm.org/D26803

llvm-svn: 287545
llvm/lib/Analysis/ValueTracking.cpp
llvm/test/Analysis/ValueTracking/knownzero-addrspacecast.ll [new file with mode: 0644]
llvm/test/Transforms/InstCombine/loadstore-alignment.ll