gallivm: fixes for LLVM-15 opaque pointers in lp_bld_nir_aos.c
authorMihai Preda <mhpreda@gmail.com>
Tue, 26 Jul 2022 12:43:30 +0000 (15:43 +0300)
committerMarge Bot <emma+marge@anholt.net>
Sat, 3 Sep 2022 03:31:34 +0000 (03:31 +0000)
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18334>

src/gallium/auxiliary/gallivm/lp_bld_nir_aos.c

index c449b5d..226bb5e 100644 (file)
@@ -172,7 +172,7 @@ emit_load_reg(struct lp_build_nir_context *bld_base,
               LLVMValueRef reg_storage)
 {
    struct gallivm_state *gallivm = bld_base->base.gallivm;
-   return LLVMBuildLoad(gallivm->builder, reg_storage, "");
+   return LLVMBuildLoad2(gallivm->builder, reg_bld->vec_type, reg_storage, "");
 }
 
 
@@ -195,7 +195,7 @@ emit_store_reg(struct lp_build_nir_context *bld_base,
       return;
    }
 
-   LLVMValueRef cur = LLVMBuildLoad(gallivm->builder, reg_storage, "");
+   LLVMValueRef cur = LLVMBuildLoad2(gallivm->builder, reg_bld->vec_type, reg_storage, "");
    LLVMTypeRef i32t = LLVMInt32TypeInContext(gallivm->context);
    LLVMValueRef shuffles[LP_MAX_VECTOR_LENGTH];
    for (unsigned j = 0; j < 16; j++) {
@@ -238,10 +238,9 @@ emit_load_ubo(struct lp_build_nir_context *bld_base,
       LLVMValueRef this_offset = lp_build_const_int32(gallivm,
                                                       offset_val + chan);
 
-      LLVMValueRef scalar_ptr = LLVMBuildGEP(builder, bld->consts_ptr,
-                                             &this_offset, 1, "");
-
-      LLVMValueRef scalar = LLVMBuildLoad(builder, scalar_ptr, "");
+      LLVMTypeRef scalar_type = LLVMInt8TypeInContext(gallivm->context);
+      LLVMValueRef scalar_ptr = LLVMBuildGEP2(builder, scalar_type, bld->consts_ptr, &this_offset, 1, "");
+      LLVMValueRef scalar = LLVMBuildLoad2(builder, scalar_type, scalar_ptr, "");
 
       lp_build_name(scalar, "const[%u].%c", offset_val, "xyzw"[chan]);