aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorFrancisco Jerez <[email protected]>2016-09-01 19:34:18 -0700
committerFrancisco Jerez <[email protected]>2016-09-14 14:50:55 -0700
commitb42c13a5b8ac7d643bbf4c1592607811a81b4ebb (patch)
treef8de2847535fa7899339b11040c6885ec1124d56 /src/mesa
parent32d67923b28e55cfe23883510509644e788003f0 (diff)
i965/fs: Drop fs_inst::overwrites_reg() in favor of regions_overlap().
fs_inst::overwrites_reg is rather easy to misuse because it cannot tell how large the register region starting at 'reg' is, so in cases where the destination region starts after 'reg' it may give a misleading result. regions_overlap() is somewhat more verbose to use but handles arbitrary overlap correctly so it should generally be used instead. Reviewed-by: Iago Toral Quiroga <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs.cpp6
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs_cmod_propagation.cpp3
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp6
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs_cse.cpp4
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs_register_coalesce.cpp6
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs_saturate_propagation.cpp3
-rw-r--r--src/mesa/drivers/dri/i965/brw_ir_fs.h1
7 files changed, 15 insertions, 14 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index f5ae60372f6..a52e5a37950 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -241,12 +241,6 @@ fs_inst::equals(fs_inst *inst) const
}
bool
-fs_inst::overwrites_reg(const fs_reg &reg) const
-{
- return reg.in_range(dst, DIV_ROUND_UP(size_written, REG_SIZE));
-}
-
-bool
fs_inst::is_send_from_grf() const
{
switch (opcode) {
diff --git a/src/mesa/drivers/dri/i965/brw_fs_cmod_propagation.cpp b/src/mesa/drivers/dri/i965/brw_fs_cmod_propagation.cpp
index 291ae4c24d2..2d50c92e9e3 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_cmod_propagation.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_cmod_propagation.cpp
@@ -88,7 +88,8 @@ opt_cmod_propagation_local(const gen_device_info *devinfo, bblock_t *block)
bool read_flag = false;
foreach_inst_in_block_reverse_starting_from(fs_inst, scan_inst, inst) {
- if (scan_inst->overwrites_reg(inst->src[0])) {
+ if (regions_overlap(scan_inst->dst, scan_inst->size_written,
+ inst->src[0], inst->size_read(0))) {
if (scan_inst->is_partial_write() ||
scan_inst->dst.offset != inst->src[0].offset ||
scan_inst->exec_size != inst->exec_size)
diff --git a/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp b/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp
index 4a56aff5bdc..bd534bf65bf 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp
@@ -161,8 +161,10 @@ fs_copy_prop_dataflow::setup_initial_values()
/* Mark ACP entries which are killed by this instruction. */
for (int i = 0; i < num_acp; i++) {
- if (inst->overwrites_reg(acp[i]->dst) ||
- inst->overwrites_reg(acp[i]->src)) {
+ if (regions_overlap(inst->dst, inst->size_written,
+ acp[i]->dst, acp[i]->size_written) ||
+ regions_overlap(inst->dst, inst->size_written,
+ acp[i]->src, acp[i]->size_read)) {
BITSET_SET(bd[block->num].kill, i);
}
}
diff --git a/src/mesa/drivers/dri/i965/brw_fs_cse.cpp b/src/mesa/drivers/dri/i965/brw_fs_cse.cpp
index 2acbfea71f0..48220efd730 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_cse.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_cse.cpp
@@ -335,7 +335,9 @@ fs_visitor::opt_cse_local(bblock_t *block)
/* Kill all AEB entries that use the destination we just
* overwrote.
*/
- if (inst->overwrites_reg(entry->generator->src[i])) {
+ if (regions_overlap(inst->dst, inst->size_written,
+ entry->generator->src[i],
+ entry->generator->size_read(i))) {
entry->remove();
ralloc_free(entry);
break;
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 694cc0b0dd4..f56f05b7e9b 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_register_coalesce.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_register_coalesce.cpp
@@ -138,8 +138,10 @@ can_coalesce_vars(brw::fs_live_variables *live_intervals,
if (scan_ip > end_ip)
return true; /* registers do not interfere */
- if (scan_inst->overwrites_reg(inst->dst) ||
- scan_inst->overwrites_reg(inst->src[0]))
+ if (regions_overlap(scan_inst->dst, scan_inst->size_written,
+ inst->dst, inst->size_written) ||
+ regions_overlap(scan_inst->dst, scan_inst->size_written,
+ inst->src[0], inst->size_read(0)))
return false; /* registers interfere */
}
}
diff --git a/src/mesa/drivers/dri/i965/brw_fs_saturate_propagation.cpp b/src/mesa/drivers/dri/i965/brw_fs_saturate_propagation.cpp
index 60bb1c049ca..1c97a507d8c 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_saturate_propagation.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_saturate_propagation.cpp
@@ -64,7 +64,8 @@ opt_saturate_propagation_local(fs_visitor *v, bblock_t *block)
bool interfered = false;
foreach_inst_in_block_reverse_starting_from(fs_inst, scan_inst, inst) {
- if (scan_inst->overwrites_reg(inst->src[0])) {
+ if (regions_overlap(scan_inst->dst, scan_inst->size_written,
+ inst->src[0], inst->size_read(0))) {
if (scan_inst->is_partial_write() ||
(scan_inst->dst.type != inst->dst.type &&
!scan_inst->can_change_types()))
diff --git a/src/mesa/drivers/dri/i965/brw_ir_fs.h b/src/mesa/drivers/dri/i965/brw_ir_fs.h
index c688345fdfd..5275953363b 100644
--- a/src/mesa/drivers/dri/i965/brw_ir_fs.h
+++ b/src/mesa/drivers/dri/i965/brw_ir_fs.h
@@ -334,7 +334,6 @@ public:
void resize_sources(uint8_t num_sources);
bool equals(fs_inst *inst) const;
- bool overwrites_reg(const fs_reg &reg) const;
bool is_send_from_grf() const;
bool is_partial_write() const;
bool is_copy_payload(const brw::simple_allocator &grf_alloc) const;