diff --git a/src/amd/llvm/ac_llvm_build.c b/src/amd/llvm/ac_llvm_build.c index 7122063d45e..01e92298de5 100644 --- a/src/amd/llvm/ac_llvm_build.c +++ b/src/amd/llvm/ac_llvm_build.c @@ -1164,7 +1164,7 @@ LLVMValueRef ac_build_load(struct ac_llvm_context *ctx, LLVMValueRef base_ptr, L return ac_build_load_custom(ctx, base_ptr, index, false, false, false); } -LLVMValueRef ac_build_load_invariant(struct ac_llvm_context *ctx, LLVMValueRef base_ptr, +LLVMValueRef ac_build_load_invariant(struct ac_llvm_context *ctx, LLVMTypeRef type, LLVMValueRef base_ptr, LLVMValueRef index) { return ac_build_load_custom(ctx, base_ptr, index, false, true, false); diff --git a/src/amd/llvm/ac_llvm_build.h b/src/amd/llvm/ac_llvm_build.h index add6cc2ed4f..b9b3d06f661 100644 --- a/src/amd/llvm/ac_llvm_build.h +++ b/src/amd/llvm/ac_llvm_build.h @@ -262,7 +262,7 @@ void ac_build_indexed_store(struct ac_llvm_context *ctx, LLVMValueRef base_ptr, LLVMValueRef value); LLVMValueRef ac_build_load(struct ac_llvm_context *ctx, LLVMValueRef base_ptr, LLVMValueRef index); -LLVMValueRef ac_build_load_invariant(struct ac_llvm_context *ctx, LLVMValueRef base_ptr, +LLVMValueRef ac_build_load_invariant(struct ac_llvm_context *ctx, LLVMTypeRef type, LLVMValueRef base_ptr, LLVMValueRef index); LLVMValueRef ac_build_load_to_sgpr(struct ac_llvm_context *ctx, LLVMValueRef base_ptr, LLVMValueRef index); diff --git a/src/amd/llvm/ac_nir_to_llvm.c b/src/amd/llvm/ac_nir_to_llvm.c index 5bbb0c1be64..e9fc7f6d1d7 100644 --- a/src/amd/llvm/ac_nir_to_llvm.c +++ b/src/amd/llvm/ac_nir_to_llvm.c @@ -3725,10 +3725,8 @@ static bool visit_intrinsic(struct ac_nir_context *ctx, nir_intrinsic_instr *ins if (ctx->abi->load_grid_size_from_user_sgpr) { result = ac_get_arg(&ctx->ac, ctx->args->num_work_groups); } else { - LLVMTypeRef ptr_type = ac_array_in_const_addr_space(ctx->ac.v3i32); LLVMValueRef ptr = ac_get_arg(&ctx->ac, ctx->args->num_work_groups); - ptr = LLVMBuildBitCast(ctx->ac.builder, ptr, ptr_type, ""); - result = ac_build_load_invariant(&ctx->ac, ptr, ctx->ac.i32_0); + result = ac_build_load_invariant(&ctx->ac, ctx->ac.v3i32, ptr, ctx->ac.i32_0); } if (nir_dest_bit_size(instr->dest) == 64) result = LLVMBuildZExt(ctx->ac.builder, result, LLVMVectorType(ctx->ac.i64, 3), "");