ac: handle pointer types to LDS in ac_get_elem_bits()
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Mon, 11 Nov 2019 10:34:05 +0000 (11:34 +0100)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Tue, 12 Nov 2019 07:32:15 +0000 (08:32 +0100)
This fixes crashes with some
dEQP-VK.spirv_assembly.instruction.spirv1p4.* tests.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/amd/llvm/ac_llvm_build.c

index ece2b3f42cb90757b212dc6c3c7e16fcb1934195..4515f696e74bdaf3d6be7826e1580e83db4b345b 100644 (file)
@@ -177,6 +177,11 @@ ac_get_elem_bits(struct ac_llvm_context *ctx, LLVMTypeRef type)
        if (LLVMGetTypeKind(type) == LLVMIntegerTypeKind)
                return LLVMGetIntTypeWidth(type);
 
+       if (LLVMGetTypeKind(type) == LLVMPointerTypeKind) {
+               if (LLVMGetPointerAddressSpace(type) == AC_ADDR_SPACE_LDS)
+                       return 32;
+       }
+
        if (type == ctx->f16)
                return 16;
        if (type == ctx->f32)