[PATCH] D51790: AMDGPU: Don't abort on unknown addrspace argument
Matt Arsenault via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 7 08:15:15 PDT 2018
arsenm created this revision.
arsenm added reviewers: kzhuravl, scott.linder.
Herald added subscribers: t-tye, tpr, dstuttard, yaxunl, nhaehnle, wdng, jvesely.
https://reviews.llvm.org/D51790
Files:
lib/Target/AMDGPU/AMDGPUHSAMetadataStreamer.cpp
test/CodeGen/AMDGPU/hsa-metadata-from-llvm-ir-full.ll
Index: test/CodeGen/AMDGPU/hsa-metadata-from-llvm-ir-full.ll
===================================================================
--- test/CodeGen/AMDGPU/hsa-metadata-from-llvm-ir-full.ll
+++ test/CodeGen/AMDGPU/hsa-metadata-from-llvm-ir-full.ll
@@ -1473,6 +1473,17 @@
ret void
}
+; CHECK: - Name: unknown_addrspace_kernarg
+; CHECK: Args:
+; CHECK-NEXT: - Name: ptr
+; CHECK-NEXT: Size: 8
+; CHECK-NEXT: Align: 8
+; CHECK-NEXT: ValueKind: GlobalBuffer
+; CHECK-NEXT: ValueType: I32
+define amdgpu_kernel void @unknown_addrspace_kernarg(i32 addrspace(12345)* %ptr) #0 {
+ ret void
+}
+
attributes #0 = { "amdgpu-implicitarg-num-bytes"="48" }
attributes #1 = { "amdgpu-implicitarg-num-bytes"="48" "runtime-handle"="__test_block_invoke_kernel_runtime_handle" }
attributes #2 = { "amdgpu-implicitarg-num-bytes"="48" "calls-enqueue-kernel" }
Index: lib/Target/AMDGPU/AMDGPUHSAMetadataStreamer.cpp
===================================================================
--- lib/Target/AMDGPU/AMDGPUHSAMetadataStreamer.cpp
+++ lib/Target/AMDGPU/AMDGPUHSAMetadataStreamer.cpp
@@ -76,20 +76,22 @@
AddressSpaceQualifier MetadataStreamer::getAddressSpaceQualifer(
unsigned AddressSpace) const {
- if (AddressSpace == AMDGPUAS::PRIVATE_ADDRESS)
+ switch (AddressSpace) {
+ case AMDGPUAS::PRIVATE_ADDRESS:
return AddressSpaceQualifier::Private;
- if (AddressSpace == AMDGPUAS::GLOBAL_ADDRESS)
+ case AMDGPUAS::GLOBAL_ADDRESS:
return AddressSpaceQualifier::Global;
- if (AddressSpace == AMDGPUAS::CONSTANT_ADDRESS)
+ case AMDGPUAS::CONSTANT_ADDRESS:
return AddressSpaceQualifier::Constant;
- if (AddressSpace == AMDGPUAS::LOCAL_ADDRESS)
+ case AMDGPUAS::LOCAL_ADDRESS:
return AddressSpaceQualifier::Local;
- if (AddressSpace == AMDGPUAS::FLAT_ADDRESS)
+ case AMDGPUAS::FLAT_ADDRESS:
return AddressSpaceQualifier::Generic;
- if (AddressSpace == AMDGPUAS::REGION_ADDRESS)
+ case AMDGPUAS::REGION_ADDRESS:
return AddressSpaceQualifier::Region;
-
- llvm_unreachable("Unknown address space qualifier");
+ default:
+ return AddressSpaceQualifier::Unknown;
+ }
}
ValueKind MetadataStreamer::getValueKind(Type *Ty, StringRef TypeQual,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51790.164429.patch
Type: text/x-patch
Size: 2235 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180907/2210df82/attachment.bin>
More information about the llvm-commits
mailing list