summaryrefslogtreecommitdiffstats
path: root/src/amd/common
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2017-02-24 17:16:28 +0100
committerMarek Olšák <[email protected]>2017-03-03 15:29:30 +0100
commite729dc7c46bc903f40c933d40ce507d6cd23bf83 (patch)
treed617f3a7a63bde1829733e8c50e843f4eaf7659e /src/amd/common
parent25c7969a5a09db6c6afcdde348f92ea698393e32 (diff)
radeonsi: set readnone on reads from read-only memory
Diffstat (limited to 'src/amd/common')
-rw-r--r--src/amd/common/ac_llvm_build.c11
-rw-r--r--src/amd/common/ac_llvm_build.h3
2 files changed, 11 insertions, 3 deletions
diff --git a/src/amd/common/ac_llvm_build.c b/src/amd/common/ac_llvm_build.c
index 42965b6a544..f0ab9cb1367 100644
--- a/src/amd/common/ac_llvm_build.c
+++ b/src/amd/common/ac_llvm_build.c
@@ -619,7 +619,8 @@ ac_build_buffer_load(struct ac_llvm_context *ctx,
LLVMValueRef soffset,
unsigned inst_offset,
unsigned glc,
- unsigned slc)
+ unsigned slc,
+ bool readonly_memory)
{
unsigned func = CLAMP(num_channels, 1, 3) - 1;
@@ -651,7 +652,13 @@ ac_build_buffer_load(struct ac_llvm_context *ctx,
type_names[func]);
return ac_emit_llvm_intrinsic(ctx, name, types[func], args,
- ARRAY_SIZE(args), AC_FUNC_ATTR_READONLY);
+ ARRAY_SIZE(args),
+ /* READNONE means writes can't
+ * affect it, while READONLY means
+ * that writes can affect it. */
+ readonly_memory ?
+ AC_FUNC_ATTR_READNONE :
+ AC_FUNC_ATTR_READONLY);
} else {
LLVMValueRef args[] = {
LLVMBuildBitCast(ctx->builder, rsrc, ctx->v16i8, ""),
diff --git a/src/amd/common/ac_llvm_build.h b/src/amd/common/ac_llvm_build.h
index e6bb90fd7ab..e6e4e434e2e 100644
--- a/src/amd/common/ac_llvm_build.h
+++ b/src/amd/common/ac_llvm_build.h
@@ -155,7 +155,8 @@ ac_build_buffer_load(struct ac_llvm_context *ctx,
LLVMValueRef soffset,
unsigned inst_offset,
unsigned glc,
- unsigned slc);
+ unsigned slc,
+ bool readonly_memory);
LLVMValueRef
ac_get_thread_id(struct ac_llvm_context *ctx);