From d52a423f60fb2309bb90318eebc04e8b4d18dc89 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 20 Jul 2021 13:37:31 -0700 Subject: [PATCH] nir/gcm: Clear out pass_flags before starting With this pass enabled in Intel drivers, running shader-db on shaders/unity/38.shader_test resulted in Program received signal SIGSEGV, Segmentation fault. gcm_schedule_early_src (src=0x555555d45348, void_state=0x7fffffffba40) at ../../SOURCE/master/src/compiler/nir/nir_opt_gcm.c:297 297 if (info->early_block->index < src_info->early_block->index) (gdb) print src_info->early_block $1 = (nir_block *) 0x0 I tracked this down to an early exit from gcm_schedule_early_instr on the parent instruction because instr->pass_flags was 0x1c. That should be an impossible value for this pass, so I inferred that pass_flags must have dirt left from some previous pass. Fixes: 8dfe6f672f4 ("nir/GCM: Use pass_flags instead of bitsets for tracking visited/pinned") Reviewed-by: Timothy Arceri Part-of: (cherry picked from commit 436668874a1508edf127be16873c6811fe13a3e6) --- .pick_status.json | 2 +- src/compiler/nir/nir_opt_gcm.c | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.pick_status.json b/.pick_status.json index 9b7d149d02f..8013d1bc27a 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -481,7 +481,7 @@ "description": "nir/gcm: Clear out pass_flags before starting", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "8dfe6f672f4f3e226089c6cc8d392fcd39dff5cb" }, diff --git a/src/compiler/nir/nir_opt_gcm.c b/src/compiler/nir/nir_opt_gcm.c index 7317ded09ca..4fa5bdfc528 100644 --- a/src/compiler/nir/nir_opt_gcm.c +++ b/src/compiler/nir/nir_opt_gcm.c @@ -604,6 +604,11 @@ opt_gcm_impl(nir_function_impl *impl, bool value_number) nir_metadata_require(impl, nir_metadata_block_index | nir_metadata_dominance); + /* A previous pass may have left pass_flags dirty, so clear it all out. */ + nir_foreach_block(block, impl) + nir_foreach_instr(instr, block) + instr->pass_flags = 0; + struct gcm_state state; state.impl = impl;