OSDN Git Service

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)
commitf570b5fd165fcdc765e32f3a7ddc830270069e8c
treef4629e908a1c32cd3d340951b7b70b2549c4c342
parentab814ecdff8983c9dcfef7aa7de457288a6d7f2e
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287545 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Analysis/ValueTracking.cpp
test/Analysis/ValueTracking/knownzero-addrspacecast.ll [new file with mode: 0644]
test/Transforms/InstCombine/loadstore-alignment.ll