ac/llvm: Fix validation error with global io
authorKonstantin Seurer <konstantin.seurer@gmail.com>
Wed, 4 Jan 2023 15:49:08 +0000 (16:49 +0100)
committerEric Engestrom <eric@engestrom.ch>
Wed, 8 Feb 2023 20:34:44 +0000 (20:34 +0000)
Fixes: afd645f0576 ("ac/llvm: remove LLVMBuildGEP usages")
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20521>
(cherry picked from commit 10ac51a52bad2c2378b2d847eae23e1366ddc46f)

.pick_status.json
src/amd/llvm/ac_nir_to_llvm.c

index 924a948..f5c9e1f 100644 (file)
         "description": "ac/llvm: Fix validation error with global io",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": "afd645f0576f2cf41b65f360787f01604f00f0f2"
     },
index feda6aa..98c99d0 100644 (file)
@@ -2163,7 +2163,7 @@ static LLVMValueRef get_global_address(struct ac_nir_context *ctx,
       LLVMTypeRef i8_ptr_type = LLVMPointerType(ctx->ac.i8, AC_ADDR_SPACE_GLOBAL);
       addr = LLVMBuildIntToPtr(ctx->ac.builder, addr, i8_ptr_type, "");
       addr = LLVMBuildGEP2(ctx->ac.builder, ctx->ac.i8, addr, &offset, 1, "");
-      return addr;
+      return LLVMBuildPointerCast(ctx->ac.builder, addr, ptr_type, "");
    } else {
       return LLVMBuildIntToPtr(ctx->ac.builder, addr, ptr_type, "");
    }