mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-19 11:02:59 +02:00
[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
This commit is contained in:
parent
b11d8eb34f
commit
1a5878b840
@ -358,7 +358,8 @@ InferAddressSpaces::collectFlatAddressExpressions(Function &F) const {
|
||||
// If the operands of the expression on the top are already explored,
|
||||
// adds that expression to the resultant postorder.
|
||||
if (PostorderStack.back().second) {
|
||||
Postorder.push_back(TopVal);
|
||||
if (TopVal->getType()->getPointerAddressSpace() == FlatAddrSpace)
|
||||
Postorder.push_back(TopVal);
|
||||
PostorderStack.pop_back();
|
||||
continue;
|
||||
}
|
||||
|
@ -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 }
|
||||
|
Loading…
Reference in New Issue
Block a user