Module: Mesa Branch: main Commit: adf28955162007af80989b65df641b3c7ae6f78c URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=adf28955162007af80989b65df641b3c7ae6f78c
Author: Mihai Preda <[email protected]> Date: Fri Aug 19 11:56:35 2022 +0300 gallivm: LLVM-15 opaque pointers: disable LLVMGetElementType(ptr_type) with opaque pointers, we can't query the element type of a pointer type Reviewed-by: Marek Olšák <[email protected]> Acked-by: Pierre-Eric Pelloux-Prayer <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18334> --- src/gallium/auxiliary/gallivm/lp_bld_ir_common.c | 5 +++-- src/gallium/auxiliary/gallivm/lp_bld_struct.c | 6 +++--- src/gallium/auxiliary/gallivm/lp_bld_swizzle.c | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/gallium/auxiliary/gallivm/lp_bld_ir_common.c b/src/gallium/auxiliary/gallivm/lp_bld_ir_common.c index d127ea0c7ff..042cd5c814f 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_ir_common.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_ir_common.c @@ -209,8 +209,9 @@ void lp_exec_mask_store(struct lp_exec_mask *mask, assert(lp_check_value(bld_store->type, val)); assert(LLVMGetTypeKind(LLVMTypeOf(dst_ptr)) == LLVMPointerTypeKind); - assert(LLVMGetElementType(LLVMTypeOf(dst_ptr)) == LLVMTypeOf(val) || - LLVMGetTypeKind(LLVMGetElementType(LLVMTypeOf(dst_ptr))) == LLVMArrayTypeKind); + assert(LLVM_VERSION_MAJOR >= 15 + || (LLVMGetElementType(LLVMTypeOf(dst_ptr)) == LLVMTypeOf(val) + || LLVMGetTypeKind(LLVMGetElementType(LLVMTypeOf(dst_ptr))) == LLVMArrayTypeKind)); if (exec_mask) { LLVMValueRef res, dst; diff --git a/src/gallium/auxiliary/gallivm/lp_bld_struct.c b/src/gallium/auxiliary/gallivm/lp_bld_struct.c index be579c4ee25..9e3e24cd9e1 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_struct.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_struct.c @@ -120,7 +120,7 @@ lp_build_array_get_ptr(struct gallivm_state *gallivm, LLVMValueRef indices[2]; LLVMValueRef element_ptr; assert(LLVMGetTypeKind(LLVMTypeOf(ptr)) == LLVMPointerTypeKind); - assert(LLVMGetTypeKind(LLVMGetElementType(LLVMTypeOf(ptr))) == LLVMArrayTypeKind); + assert(LLVM_VERSION_MAJOR >= 15 || LLVMGetTypeKind(LLVMGetElementType(LLVMTypeOf(ptr))) == LLVMArrayTypeKind); indices[0] = lp_build_const_int32(gallivm, 0); indices[1] = index; element_ptr = LLVMBuildGEP(gallivm->builder, ptr, indices, ARRAY_SIZE(indices), ""); @@ -140,7 +140,7 @@ lp_build_array_get(struct gallivm_state *gallivm, LLVMValueRef element_ptr; LLVMValueRef res; assert(LLVMGetTypeKind(LLVMTypeOf(ptr)) == LLVMPointerTypeKind); - assert(LLVMGetTypeKind(LLVMGetElementType(LLVMTypeOf(ptr))) == LLVMArrayTypeKind); + assert(LLVM_VERSION_MAJOR >= 15 || LLVMGetTypeKind(LLVMGetElementType(LLVMTypeOf(ptr))) == LLVMArrayTypeKind); element_ptr = lp_build_array_get_ptr(gallivm, ptr, index); res = LLVMBuildLoad(gallivm->builder, element_ptr, ""); #ifdef DEBUG @@ -158,7 +158,7 @@ lp_build_array_set(struct gallivm_state *gallivm, { LLVMValueRef element_ptr; assert(LLVMGetTypeKind(LLVMTypeOf(ptr)) == LLVMPointerTypeKind); - assert(LLVMGetTypeKind(LLVMGetElementType(LLVMTypeOf(ptr))) == LLVMArrayTypeKind); + assert(LLVM_VERSION_MAJOR >= 15 || LLVMGetTypeKind(LLVMGetElementType(LLVMTypeOf(ptr))) == LLVMArrayTypeKind); element_ptr = lp_build_array_get_ptr(gallivm, ptr, index); LLVMBuildStore(gallivm->builder, value, element_ptr); } diff --git a/src/gallium/auxiliary/gallivm/lp_bld_swizzle.c b/src/gallium/auxiliary/gallivm/lp_bld_swizzle.c index b23c4cbbf02..904eaa034d6 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_swizzle.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_swizzle.c @@ -63,7 +63,7 @@ lp_build_broadcast(struct gallivm_state *gallivm, LLVMTypeRef i32_type = LLVMInt32TypeInContext(gallivm->context); LLVMTypeRef i32_vec_type = LLVMVectorType(i32_type, length); - assert(LLVMGetElementType(vec_type) == LLVMTypeOf(scalar)); + assert(LLVM_VERSION_MAJOR >= 15 || LLVMGetElementType(vec_type) == LLVMTypeOf(scalar)); res = LLVMBuildInsertElement(builder, undef, scalar, LLVMConstNull(i32_type), ""); res = LLVMBuildShuffleVector(builder, res, undef, LLVMConstNull(i32_vec_type), "");
