[Mesa-dev] [PATCH 35/57] i965/fs: Simplify result_live calculation in dead_code_eliminate().
Francisco Jerez
currojerez at riseup.net
Thu Sep 8 01:49:02 UTC 2016
No need to unroll the first iteration of the loop manually.
---
src/mesa/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 4558bd4..5db31c3 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.9.0
More information about the mesa-dev
mailing list