From: Marek Olšák <marek.ol...@amd.com>

---
 src/amd/common/ac_llvm_build.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/amd/common/ac_llvm_build.c b/src/amd/common/ac_llvm_build.c
index 164f310..ed00d20 100644
--- a/src/amd/common/ac_llvm_build.c
+++ b/src/amd/common/ac_llvm_build.c
@@ -775,25 +775,28 @@ ac_build_indexed_store(struct ac_llvm_context *ctx,
  *                  dynamically uniform (i.e. load to an SGPR)
  * \param invariant Whether the load is invariant (no other opcodes affect it)
  */
 static LLVMValueRef
 ac_build_load_custom(struct ac_llvm_context *ctx, LLVMValueRef base_ptr,
                     LLVMValueRef index, bool uniform, bool invariant)
 {
        LLVMValueRef pointer, result;
 
        pointer = ac_build_gep0(ctx, base_ptr, index);
-       if (uniform)
+       /* This will be removed by InstCombine if index == 0. */
+       if (HAVE_LLVM < 0x0600 && uniform)
                LLVMSetMetadata(pointer, ctx->uniform_md_kind, ctx->empty_md);
        result = LLVMBuildLoad(ctx->builder, pointer, "");
        if (invariant)
                LLVMSetMetadata(result, ctx->invariant_load_md_kind, 
ctx->empty_md);
+       if (HAVE_LLVM >= 0x0600 && uniform)
+               LLVMSetMetadata(result, ctx->uniform_md_kind, ctx->empty_md);
        return result;
 }
 
 LLVMValueRef ac_build_load(struct ac_llvm_context *ctx, LLVMValueRef base_ptr,
                           LLVMValueRef index)
 {
        return ac_build_load_custom(ctx, base_ptr, index, false, false);
 }
 
 LLVMValueRef ac_build_load_invariant(struct ac_llvm_context *ctx,
-- 
2.7.4

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to