diff --git a/src/intel/compiler/brw_opt_saturate_propagation.cpp b/src/intel/compiler/brw_opt_saturate_propagation.cpp index 579ad7bc8d3..69959c8f69c 100644 --- a/src/intel/compiler/brw_opt_saturate_propagation.cpp +++ b/src/intel/compiler/brw_opt_saturate_propagation.cpp @@ -91,13 +91,8 @@ opt_saturate_propagation_local(brw_shader &s, bblock_t *block) { bool progress = false; - int ip = ips.end(block) + 1; - - /* Walk backwards so IPs don't become invalid. */ foreach_inst_in_block_reverse(brw_inst, inst, block) { - ip--; - if (inst->opcode != BRW_OPCODE_MOV || !inst->saturate || inst->dst.file != VGRF || @@ -122,69 +117,11 @@ opt_saturate_propagation_local(brw_shader &s, if (def->saturate) { inst->saturate = false; progress = true; - continue; } else if (defs.get_use_count(def->dst) == 1 && def->can_do_saturate() && propagate_sat(inst, def)) { progress = true; - continue; } - - /* If the def is in a different block the liveness based pass will - * not be able to make progress, so skip it. - */ - if (block != def->block) - continue; - } - - const brw_live_variables &live = s.live_analysis.require(); - int src_var = live.var_from_reg(inst->src[0]); - int src_end_ip = live.end[src_var]; - - bool interfered = false; - foreach_inst_in_block_reverse_starting_from(brw_inst, scan_inst, inst) { - if (scan_inst->exec_size == inst->exec_size && - regions_overlap(scan_inst->dst, scan_inst->size_written, - inst->src[0], inst->size_read(s.devinfo, 0))) { - if (scan_inst->is_partial_write() || - (scan_inst->dst.type != inst->dst.type && - !scan_inst->can_change_types())) - break; - - if (scan_inst->flags_written(s.devinfo) != 0) - break; - - if (scan_inst->saturate) { - inst->saturate = false; - progress = true; - } else if (src_end_ip == ip || inst->dst.equals(inst->src[0])) { - if (scan_inst->can_do_saturate() && - propagate_sat(inst, scan_inst)) { - progress = true; - } - } - break; - } - for (int i = 0; i < scan_inst->sources; i++) { - if (scan_inst->src[i].file == VGRF && - scan_inst->src[i].nr == inst->src[0].nr && - regions_overlap( - scan_inst->src[i], scan_inst->size_read(s.devinfo, i), - inst->src[0], inst->size_read(s.devinfo, 0))) { - if (scan_inst->opcode != BRW_OPCODE_MOV || - !scan_inst->saturate || - scan_inst->src[0].abs || - scan_inst->src[0].negate || - scan_inst->src[0].abs != inst->src[0].abs || - scan_inst->src[0].negate != inst->src[0].negate) { - interfered = true; - break; - } - } - } - - if (interfered) - break; } } diff --git a/src/intel/compiler/test_opt_saturate_propagation.cpp b/src/intel/compiler/test_opt_saturate_propagation.cpp index cc52a22ab68..058682d2bed 100644 --- a/src/intel/compiler/test_opt_saturate_propagation.cpp +++ b/src/intel/compiler/test_opt_saturate_propagation.cpp @@ -264,30 +264,6 @@ TEST_F(saturate_propagation_test, producer_saturates) EXPECT_SHADERS_MATCH(bld, exp); } -TEST_F(saturate_propagation_test, intervening_saturating_copy) -{ - brw_builder bld = make_shader(MESA_SHADER_FRAGMENT, 16); - brw_builder exp = make_shader(MESA_SHADER_FRAGMENT, 16); - - brw_reg dst0 = vgrf(bld, exp, BRW_TYPE_F); - brw_reg dst1 = vgrf(bld, exp, BRW_TYPE_F); - brw_reg dst2 = vgrf(bld, exp, BRW_TYPE_F); - brw_reg src0 = vgrf(bld, exp, BRW_TYPE_F); - brw_reg src1 = vgrf(bld, exp, BRW_TYPE_F); - - bld.ADD(dst0, bld.LOAD_REG(src0), bld.LOAD_REG(src1)); - bld.MOV(dst1, dst0)->saturate = true; - bld.MOV(dst2, dst0)->saturate = true; - - EXPECT_PROGRESS(brw_opt_saturate_propagation, bld); - - exp.ADD(dst0, exp.LOAD_REG(src0), exp.LOAD_REG(src1))->saturate = true; - exp.MOV(dst1, dst0); - exp.MOV(dst2, dst0); - - EXPECT_SHADERS_MATCH(bld, exp); -} - TEST_F(saturate_propagation_test, intervening_dest_write) { brw_builder bld = make_shader(MESA_SHADER_FRAGMENT, 16);