From 5c1f61d900cd24d685b9dca0341f45117199226b Mon Sep 17 00:00:00 2001 From: Karol Herbst Date: Thu, 27 Feb 2025 17:41:45 +0100 Subject: [PATCH] nir: Do not eliminate dead writes to shared memory in called functions. Fixes regressions in rusticl and c11_atomic OpenCL CTS test. Fixes: e65c1473ded ("nir: Eliminate dead writes to shared memory at the end of the program") Reviewed-by: Faith Ekstrand Part-of: --- src/compiler/nir/nir_opt_dead_write_vars.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/compiler/nir/nir_opt_dead_write_vars.c b/src/compiler/nir/nir_opt_dead_write_vars.c index 0eac227850f..4d20ae2f318 100644 --- a/src/compiler/nir/nir_opt_dead_write_vars.c +++ b/src/compiler/nir/nir_opt_dead_write_vars.c @@ -115,6 +115,10 @@ ends_program(nir_block *block) if (block->cf_node.parent->type == nir_cf_node_loop) return false; + /* Avoid called functions */ + if (!nir_cf_node_get_function(&block->cf_node)->function->is_entrypoint) + return false; + if (block->successors[0] == NULL) { /* This is the end block */ assert(block->successors[1] == NULL);