From 8329c04521884145bf15ec2cb4c85471fc8cdf61 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 1 Oct 2024 09:42:00 -0700 Subject: [PATCH] brw/copy: Don't remove instructions w/ conditional modifier Fixes: 9e750f00c3b ("intel/brw: Make opt_copy_propagation_defs clean up its own trash") Reviewed-by: Kenneth Graunke Part-of: --- src/intel/compiler/brw_fs_copy_propagation.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/intel/compiler/brw_fs_copy_propagation.cpp b/src/intel/compiler/brw_fs_copy_propagation.cpp index c22a74d9f7d..84369d97f2f 100644 --- a/src/intel/compiler/brw_fs_copy_propagation.cpp +++ b/src/intel/compiler/brw_fs_copy_propagation.cpp @@ -1849,8 +1849,17 @@ brw_fs_opt_copy_propagation_defs(fs_visitor &s) if (source_progress) { instruction_progress = true; ++uses_deleted[def->dst.nr]; - if (defs.get_use_count(def->dst) == uses_deleted[def->dst.nr]) + + /* We can copy propagate through an instruction like + * + * mov.nz.f0.0(8) %2:D, -%78:D + * + * but deleting the instruction may alter the program. + */ + if (def->conditional_mod == BRW_CONDITIONAL_NONE && + defs.get_use_count(def->dst) == uses_deleted[def->dst.nr]) { def->remove(defs.get_block(def->dst), true); + } } }