[Mesa-dev] [PATCH 14/15] ac: place amdgpu.uniform on loads instead of GEPs
Marek Olšák
maraeo at gmail.com
Sat Jan 6 11:12:51 UTC 2018
From: Marek Olšák <marek.olsak at 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
More information about the mesa-dev
mailing list