aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorMatt Turner <[email protected]>2014-04-15 18:15:59 -0700
committerMatt Turner <[email protected]>2014-04-18 09:16:19 -0700
commita975b2f55cd40a0ca53b72a17b05c0de08254f6b (patch)
treef93e7ef9a0ea938d2af55d627b1f5a573c69774e /src/mesa
parentef6127ff690031e0eec9eb9ee959cede542ad244 (diff)
i965/fs: Recognize nop-MOV instructions early.
And avoid rewriting other instructions unnecessarily. Removes a few self-moves we weren't able to handle because they were components of a large VGRF. instructions in affected programs: 830 -> 826 (-0.48%) Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs_register_coalesce.cpp20
1 files changed, 17 insertions, 3 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 f6d9b680b22..6a8842d07d0 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_register_coalesce.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_register_coalesce.cpp
@@ -44,6 +44,16 @@
#include "brw_fs_live_variables.h"
static bool
+is_nop_mov(const fs_inst *inst)
+{
+ if (inst->opcode == BRW_OPCODE_MOV) {
+ return inst->dst.equals(inst->src[0]);
+ }
+
+ return false;
+}
+
+static bool
is_coalesce_candidate(const fs_inst *inst, const int *virtual_grf_sizes)
{
if (inst->opcode != BRW_OPCODE_MOV ||
@@ -70,9 +80,7 @@ can_coalesce_vars(brw::fs_live_variables *live_intervals,
const exec_list *instructions, const fs_inst *inst,
int var_to, int var_from)
{
- if (live_intervals->vars_interfere(var_from, var_to) &&
- !inst->dst.equals(inst->src[0])) {
-
+ if (live_intervals->vars_interfere(var_from, var_to)) {
/* We know that the live ranges of A (var_from) and B (var_to)
* interfere because of the ->vars_interfere() call above. If the end
* of B's live range is after the end of A's range, then we know two
@@ -131,6 +139,12 @@ fs_visitor::register_coalesce()
if (!is_coalesce_candidate(inst, virtual_grf_sizes))
continue;
+ if (is_nop_mov(inst)) {
+ inst->opcode = BRW_OPCODE_NOP;
+ progress = true;
+ continue;
+ }
+
if (reg_from != inst->src[0].reg) {
reg_from = inst->src[0].reg;