aboutsummaryrefslogtreecommitdiffstats
path: root/src/amd/llvm
diff options
context:
space:
mode:
authorSamuel Pitoiset <[email protected]>2019-12-02 14:58:00 +0100
committerSamuel Pitoiset <[email protected]>2019-12-03 09:41:33 +0100
commitf63a3132e8cf660c22bc9943535e264ba91f63eb (patch)
tree3a51974d2d1f32aa6cb4adeb05393ad5a0a826b5 /src/amd/llvm
parentdde734030bcdac40e63a0b251903c0281db170ee (diff)
ac/llvm: fix atomic var operations if source isn't a deref
Fixes some CTS regressions. Fixes: e61a826f396 ("ac/llvm: fix pointer type for global atomics") Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Bas Nieuwenhuizen <[email protected]>
Diffstat (limited to 'src/amd/llvm')
-rw-r--r--src/amd/llvm/ac_nir_to_llvm.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/amd/llvm/ac_nir_to_llvm.c b/src/amd/llvm/ac_nir_to_llvm.c
index 830866bc5cb..4c8216dbe73 100644
--- a/src/amd/llvm/ac_nir_to_llvm.c
+++ b/src/amd/llvm/ac_nir_to_llvm.c
@@ -3022,13 +3022,15 @@ static LLVMValueRef visit_var_atomic(struct ac_nir_context *ctx,
const char *sync_scope = LLVM_VERSION_MAJOR >= 9 ? "workgroup-one-as" : "workgroup";
- nir_deref_instr *deref = nir_instr_as_deref(instr->src[0].ssa->parent_instr);
- if (deref->mode == nir_var_mem_global) {
- /* use "singlethread" sync scope to implement relaxed ordering */
- sync_scope = LLVM_VERSION_MAJOR >= 9 ? "singlethread-one-as" : "singlethread";
-
- LLVMTypeRef ptr_type = LLVMPointerType(LLVMTypeOf(src), LLVMGetPointerAddressSpace(LLVMTypeOf(ptr)));
- ptr = LLVMBuildBitCast(ctx->ac.builder, ptr, ptr_type , "");
+ if (instr->src[0].ssa->parent_instr->type == nir_instr_type_deref) {
+ nir_deref_instr *deref = nir_instr_as_deref(instr->src[0].ssa->parent_instr);
+ if (deref->mode == nir_var_mem_global) {
+ /* use "singlethread" sync scope to implement relaxed ordering */
+ sync_scope = LLVM_VERSION_MAJOR >= 9 ? "singlethread-one-as" : "singlethread";
+
+ LLVMTypeRef ptr_type = LLVMPointerType(LLVMTypeOf(src), LLVMGetPointerAddressSpace(LLVMTypeOf(ptr)));
+ ptr = LLVMBuildBitCast(ctx->ac.builder, ptr, ptr_type , "");
+ }
}
if (instr->intrinsic == nir_intrinsic_shared_atomic_comp_swap ||