[PATCH] D34991: [InferAddressSpaces] Fix assertion about null pointer
Yaxun Liu via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 6 19:40:40 PDT 2017
This revision was automatically updated to reflect the committed changes.
yaxunl marked an inline comment as done.
Closed by commit rL307349: [InferAddressSpaces] Fix assertion about null pointer (authored by yaxunl).
Changed prior to commit:
https://reviews.llvm.org/D34991?vs=105195&id=105579#toc
Repository:
rL LLVM
https://reviews.llvm.org/D34991
Files:
llvm/trunk/lib/Transforms/Scalar/InferAddressSpaces.cpp
llvm/trunk/test/Transforms/InferAddressSpaces/AMDGPU/basic.ll
Index: llvm/trunk/lib/Transforms/Scalar/InferAddressSpaces.cpp
===================================================================
--- llvm/trunk/lib/Transforms/Scalar/InferAddressSpaces.cpp
+++ llvm/trunk/lib/Transforms/Scalar/InferAddressSpaces.cpp
@@ -358,7 +358,8 @@
// 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;
}
Index: llvm/trunk/test/Transforms/InferAddressSpaces/AMDGPU/basic.ll
===================================================================
--- llvm/trunk/test/Transforms/InferAddressSpaces/AMDGPU/basic.ll
+++ llvm/trunk/test/Transforms/InferAddressSpaces/AMDGPU/basic.ll
@@ -170,4 +170,16 @@
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 }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34991.105579.patch
Type: text/x-patch
Size: 1490 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170707/2c4978a2/attachment.bin>
More information about the llvm-commits
mailing list