diff --git a/.pick_status.json b/.pick_status.json index b19eba3982d..8ebf8aa9c85 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -1274,7 +1274,7 @@ "description": "brw/cse: Don't eliminate instructions that write flags", "nominated": true, "nomination_type": 2, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "234c45c929e0341f1d0c2a51a587c4ce7e4bba52", "notes": null diff --git a/src/intel/compiler/brw_fs_cse.cpp b/src/intel/compiler/brw_fs_cse.cpp index c5838e38919..e1c0ab6b0af 100644 --- a/src/intel/compiler/brw_fs_cse.cpp +++ b/src/intel/compiler/brw_fs_cse.cpp @@ -475,6 +475,19 @@ brw_fs_opt_cse_defs(fs_visitor &s) assert(ops_must_match); } + /* Some later instruction could depend on the flags written by + * this instruction. It can only be removed if the previous + * instruction that write the flags is identical. + */ + if (inst->flags_written(devinfo)) { + bool ignored; + + if (last_flag_write == NULL || + !instructions_match(last_flag_write, inst, &ignored)) { + continue; + } + } + progress = true; need_remaps = true; remap_table[inst->dst.nr] =