diff options
| author | Yaxun Liu <Yaxun.Liu@amd.com> | 2017-07-07 02:40:13 +0000 | 
|---|---|---|
| committer | Yaxun Liu <Yaxun.Liu@amd.com> | 2017-07-07 02:40:13 +0000 | 
| commit | b909f11a319ae62e683d1f9d82e28a05b360b8ae (patch) | |
| tree | b6eddfbdb32581f7f4ae2ef2a9cca65fe5d6004d /llvm/test/Transforms/InferAddressSpaces/AMDGPU/basic.ll | |
| parent | 5e3d33a781ba868a66b1baacd9613164a132127f (diff) | |
| download | bcm5719-llvm-b909f11a319ae62e683d1f9d82e28a05b360b8ae.tar.gz bcm5719-llvm-b909f11a319ae62e683d1f9d82e28a05b360b8ae.zip | |
[InferAddressSpaces] Fix assertion about null pointer
InferAddressSpaces does not check address space in collectFlatAddressExpressions,
which causes values with non flat address space put into Postorder and causes
assertion in cloneValueWithNewAddressSpace.
This patch fixes assertion in OpenCL 2.0 conformance test generic_address_space
subtest for amdgcn target.
Differential Revision: https://reviews.llvm.org/D34991
llvm-svn: 307349
Diffstat (limited to 'llvm/test/Transforms/InferAddressSpaces/AMDGPU/basic.ll')
| -rw-r--r-- | llvm/test/Transforms/InferAddressSpaces/AMDGPU/basic.ll | 12 | 
1 files changed, 12 insertions, 0 deletions
| diff --git a/llvm/test/Transforms/InferAddressSpaces/AMDGPU/basic.ll b/llvm/test/Transforms/InferAddressSpaces/AMDGPU/basic.ll index b566c147e9b..1eab7075403 100644 --- a/llvm/test/Transforms/InferAddressSpaces/AMDGPU/basic.ll +++ b/llvm/test/Transforms/InferAddressSpaces/AMDGPU/basic.ll @@ -170,4 +170,16 @@ define { i32 addrspace(4)*, i1 } @cmpxchg_group_to_flat_wrong_operand(i32 addrsp    ret { i32 addrspace(4)*, i1 } %ret  } +; Null pointer in local addr space +; CHECK-LABEL: @local_nullptr +; CHECK: icmp ne i8 addrspace(3)* %a, addrspacecast (i8* null to i8 addrspace(3)*) +; CHECK-NOT: i8 addrspace(3)* null +define void @local_nullptr(i32 addrspace(1)* nocapture %results, i8 addrspace(3)* %a) { +entry: +  %tobool = icmp ne i8 addrspace(3)* %a, addrspacecast (i8* null to i8 addrspace(3)*) +  %conv = zext i1 %tobool to i32 +  store i32 %conv, i32 addrspace(1)* %results, align 4 +  ret void +} +  attributes #0 = { nounwind } | 

