[Mesa-dev] [PATCH] i965/fs: Clarify and optimize register coalescing interference check.
Matt Turner
mattst88 at gmail.com
Fri Nov 21 13:06:52 PST 2014
With bblock_t::end_ip, we can skip entire blocks rather than checking
every instruction in them. Also by making the loops nested (explicitly,
it already was a nested loop), the continue seen at the end of the first
hunk (when viewed with git show -w) will do what the programmer expects.
No functional change.
---
.../drivers/dri/i965/brw_fs_register_coalesce.cpp | 28 +++++++++++-----------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_fs_register_coalesce.cpp b/src/mesa/drivers/dri/i965/brw_fs_register_coalesce.cpp
index 62788cd..9c8ca32 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_register_coalesce.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_register_coalesce.cpp
@@ -126,26 +126,26 @@ can_coalesce_vars(brw::fs_live_variables *live_intervals,
return false;
int start_ip = MIN2(start_to, start_from);
- int scan_ip = -1;
- foreach_block_and_inst(block, fs_inst, scan_inst, cfg) {
- scan_ip++;
-
- if (scan_ip < start_ip)
+ foreach_block(block, cfg) {
+ if (start_ip > block->end_ip)
continue;
- if (scan_inst->is_control_flow())
- return false;
+ int scan_ip = block->start_ip - 1;
- if (scan_ip <= live_intervals->start[var_to])
- continue;
+ foreach_inst_in_block(fs_inst, scan_inst, block) {
+ scan_ip++;
+
+ if (scan_ip <= live_intervals->start[var_to])
+ continue;
- if (scan_ip > live_intervals->end[var_to])
- return true;
+ if (scan_ip > live_intervals->end[var_to])
+ return true;
- if (scan_inst->dst.equals(inst->dst) ||
- scan_inst->dst.equals(inst->src[0]))
- return false;
+ if (scan_inst->dst.equals(inst->dst) ||
+ scan_inst->dst.equals(inst->src[0]))
+ return false;
+ }
}
return true;
--
2.0.4
More information about the mesa-dev
mailing list