diff options
author | Francisco Jerez <currojerez@riseup.net> | 2015-07-28 12:07:56 +0300 |
---|---|---|
committer | Francisco Jerez <currojerez@riseup.net> | 2015-07-29 14:12:45 +0300 |
commit | 24d74b66883da1955f8c2223367d41470d99df6d (patch) | |
tree | 7827e3922b97b0117f0ce9fc7a56060637a4b936 /src/mesa/drivers/dri/i965/brw_fs_register_coalesce.cpp | |
parent | 170200e0fcb0b16d20bff86e1258e0a1b2034c10 (diff) | |
download | external_mesa3d-24d74b66883da1955f8c2223367d41470d99df6d.zip external_mesa3d-24d74b66883da1955f8c2223367d41470d99df6d.tar.gz external_mesa3d-24d74b66883da1955f8c2223367d41470d99df6d.tar.bz2 |
i965/fs: Simplify instruction rewrite loop in the register coalesce pass.
For some reason the loop that rewrites all occurrences of the
coalesced register was iterating over all possible offsets until it
would find one that compares equal to the offset of a source or
destination of any instruction in the program. Since the mapping
between old and new offsets is already available in the regs_to_offset
array and we know that the whole register has been coalesced we can
just look it up.
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_fs_register_coalesce.cpp')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs_register_coalesce.cpp | 27 |
1 files changed, 13 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 20a5480..72e8738 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_register_coalesce.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_register_coalesce.cpp @@ -241,20 +241,19 @@ fs_visitor::register_coalesce() } foreach_block_and_inst(block, fs_inst, scan_inst, cfg) { - for (int i = 0; i < src_size; i++) { - if (scan_inst->dst.file == GRF && - scan_inst->dst.reg == reg_from && - scan_inst->dst.reg_offset == i) { - scan_inst->dst.reg = reg_to; - scan_inst->dst.reg_offset = reg_to_offset[i]; - } - for (int j = 0; j < scan_inst->sources; j++) { - if (scan_inst->src[j].file == GRF && - scan_inst->src[j].reg == reg_from && - scan_inst->src[j].reg_offset == i) { - scan_inst->src[j].reg = reg_to; - scan_inst->src[j].reg_offset = reg_to_offset[i]; - } + if (scan_inst->dst.file == GRF && + scan_inst->dst.reg == reg_from) { + scan_inst->dst.reg = reg_to; + scan_inst->dst.reg_offset = + reg_to_offset[scan_inst->dst.reg_offset]; + } + + for (int j = 0; j < scan_inst->sources; j++) { + if (scan_inst->src[j].file == GRF && + scan_inst->src[j].reg == reg_from) { + scan_inst->src[j].reg = reg_to; + scan_inst->src[j].reg_offset = + reg_to_offset[scan_inst->src[j].reg_offset]; } } } |