intel/fs: Extend copy propagation dataflow analysis to copies with FIXED_GRF source.
authorFrancisco Jerez <currojerez@riseup.net>
Fri, 3 Jan 2020 02:54:13 +0000 (18:54 -0800)
committerFrancisco Jerez <currojerez@riseup.net>
Fri, 17 Jan 2020 21:21:27 +0000 (13:21 -0800)
This involves indexing the ACP tables used internally by
fs_copy_prop_dataflow::setup_initial_values() by reg_space() instead
of register number.  Both are nearly equivalent for virtual GRFs
(barring the single bit of entropy lost in the hash), and this makes
handling FIXED_GRFs straightforward.

Because we're only going to support FIXED_GRFs for the source of a
copy, this change is only strictly necessary during the second pass
that checks for source interference, but we also apply the same change
to the first pass for consistency.

Note that this shouldn't change the behavior of the copy propagation
pass until we start inserting FIXED_GRF entries into the ACP.  Even
then FIXED_GRF writes are extremely rare so this change will hardly
ever have an effect, but they aren't completely non-existing so we
need to handle them for correctness.

No functional nor shader-db changes.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/intel/compiler/brw_fs_copy_propagation.cpp

index 73ac1b66340730296fc166e5570b1b1f479e4c70..e6eb174e0f2c4163a54d58b0a5ab17925b22084a 100644 (file)
@@ -194,7 +194,7 @@ fs_copy_prop_dataflow::setup_initial_values()
        * destinations.
        */
       for (int i = 0; i < num_acp; i++) {
-         unsigned idx = acp[i]->dst.nr & (acp_table_size - 1);
+         unsigned idx = reg_space(acp[i]->dst) & (acp_table_size - 1);
          acp_table[idx].push_tail(acp[i]);
       }
 
@@ -203,7 +203,7 @@ fs_copy_prop_dataflow::setup_initial_values()
             if (inst->dst.file != VGRF)
                continue;
 
-            unsigned idx = inst->dst.nr & (acp_table_size - 1);
+            unsigned idx = reg_space(inst->dst) & (acp_table_size - 1);
             foreach_in_list(acp_entry, entry, &acp_table[idx]) {
                if (regions_overlap(inst->dst, inst->size_written,
                                    entry->dst, entry->size_written))
@@ -220,16 +220,17 @@ fs_copy_prop_dataflow::setup_initial_values()
        * sources.
        */
       for (int i = 0; i < num_acp; i++) {
-         unsigned idx = acp[i]->src.nr & (acp_table_size - 1);
+         unsigned idx = reg_space(acp[i]->src) & (acp_table_size - 1);
          acp_table[idx].push_tail(acp[i]);
       }
 
       foreach_block (block, cfg) {
          foreach_inst_in_block(fs_inst, inst, block) {
-            if (inst->dst.file != VGRF)
+            if (inst->dst.file != VGRF &&
+                inst->dst.file != FIXED_GRF)
                continue;
 
-            unsigned idx = inst->dst.nr & (acp_table_size - 1);
+            unsigned idx = reg_space(inst->dst) & (acp_table_size - 1);
             foreach_in_list(acp_entry, entry, &acp_table[idx]) {
                if (regions_overlap(inst->dst, inst->size_written,
                                    entry->src, entry->size_read))