diff --git a/src/compiler/nir/nir_opt_offsets.c b/src/compiler/nir/nir_opt_offsets.c index e2ec1daeded..471fab1747d 100644 --- a/src/compiler/nir/nir_opt_offsets.c +++ b/src/compiler/nir/nir_opt_offsets.c @@ -128,9 +128,16 @@ process_instr(nir_builder *b, nir_instr *instr, void *s) nir_intrinsic_instr *intrin = nir_instr_as_intrinsic(instr); switch (intrin->intrinsic) { + /* Note that while it's tempting to include nir_intrinsic_load_uniform + * here, freedreno doesn't want that because it can have to move the base + * back to a register plus a small constant offset, and it's not clever + * enough to minimize the code that that emits. + */ case nir_intrinsic_load_shared: + case nir_intrinsic_load_shared_ir3: return try_fold_load_store(b, intrin, state, 0); case nir_intrinsic_store_shared: + case nir_intrinsic_store_shared_ir3: return try_fold_load_store(b, intrin, state, 1); case nir_intrinsic_load_buffer_amd: return try_fold_load_store(b, intrin, state, 1); diff --git a/src/freedreno/ir3/ir3_nir.c b/src/freedreno/ir3/ir3_nir.c index 9db9b367f84..ccf3bdab63d 100644 --- a/src/freedreno/ir3/ir3_nir.c +++ b/src/freedreno/ir3/ir3_nir.c @@ -117,6 +117,7 @@ ir3_optimize_loop(struct ir3_compiler *compiler, nir_shader *s) progress |= OPT(s, nir_lower_alu); progress |= OPT(s, nir_lower_pack); progress |= OPT(s, nir_opt_constant_folding); + progress |= OPT(s, nir_opt_offsets); nir_load_store_vectorize_options vectorize_opts = { .modes = nir_var_mem_ubo,