From 0bc46cc9619b8ae43e7a7c96bfe91f19371d301d Mon Sep 17 00:00:00 2001 From: Francisco Jerez Date: Thu, 1 Sep 2016 16:46:34 -0700 Subject: [PATCH] i965/fs: Simplify result_live calculation in dead_code_eliminate(). No need to unroll the first iteration of the loop manually. Reviewed-by: Iago Toral Quiroga --- .../drivers/dri/i965/brw_fs_dead_code_eliminate.cpp | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_fs_dead_code_eliminate.cpp b/src/mesa/drivers/dri/i965/brw_fs_dead_code_eliminate.cpp index 4558bd42a24..5db31c3871d 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_dead_code_eliminate.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_dead_code_eliminate.cpp @@ -53,17 +53,11 @@ fs_visitor::dead_code_eliminate() foreach_inst_in_block_reverse_safe(fs_inst, inst, block) { if (inst->dst.file == VGRF && !inst->has_side_effects()) { + const unsigned var = live_intervals->var_from_reg(inst->dst); bool result_live = false; - if (regs_written(inst) == 1) { - int var = live_intervals->var_from_reg(inst->dst); - result_live = BITSET_TEST(live, var); - } else { - int var = live_intervals->var_from_reg(inst->dst); - for (unsigned i = 0; i < regs_written(inst); i++) { - result_live = result_live || BITSET_TEST(live, var + i); - } - } + for (unsigned i = 0; i < regs_written(inst); i++) + result_live |= BITSET_TEST(live, var + i); if (!result_live) { progress = true; -- 2.30.2