Revert "r300: be less agresive with copy propagate in loops"
authorPavel Ondračka <pavel.ondracka@gmail.com>
Wed, 21 Sep 2022 19:20:32 +0000 (21:20 +0200)
committerPavel Ondračka <pavel.ondracka@gmail.com>
Mon, 3 Oct 2022 06:49:24 +0000 (08:49 +0200)
This reverts commit 2bdffe7eb212ddc10f2ed9ef51095886a55109b4.
This solution was mostly a workaround to fix the copy propagation.
A (hopefully) proper fix to the reader detection is in the next commit.

Signed-off-by: Pavel Ondračka <pavel.ondracka@gmail.com>
Reviewed-by: Filip Gawin <filip@gawin.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18900>

src/gallium/drivers/r300/compiler/radeon_dataflow.c
src/gallium/drivers/r300/compiler/radeon_dataflow.h
src/gallium/drivers/r300/compiler/radeon_optimize.c

index c0acb3e..302576b 100644 (file)
@@ -688,7 +688,6 @@ static void get_readers_for_single_write(
        unsigned int branch_depth = 0;
        struct rc_instruction * endloop = NULL;
        unsigned int abort_on_read_at_endloop = 0;
-       int readers_before_endloop = -1;
        struct get_readers_callback_data * d = userdata;
 
        d->ReaderData->Writer = writer;
@@ -696,7 +695,6 @@ static void get_readers_for_single_write(
        d->ReaderData->AbortOnWrite = 0;
        d->ReaderData->LoopDepth = 0;
        d->ReaderData->InElse = 0;
-       d->ReaderData->ReadersAfterEndloop = false;
        d->DstFile = dst_file;
        d->DstIndex = dst_index;
        d->DstMask = dst_mask;
@@ -782,19 +780,11 @@ static void get_readers_for_single_write(
                                get_readers_pair_read_callback, d);
                }
 
-               /* Writer was in loop and we have some readers after it.
-                * Set a flag so we can be extra careful in copy propagate.
-                */
-               if (readers_before_endloop != -1 &&
-                       d->ReaderData->ReaderCount > readers_before_endloop)
-                       d->ReaderData->ReadersAfterEndloop = true;
-
                /* This can happen when we jump from an ENDLOOP to BGNLOOP */
                if (tmp == writer) {
                        tmp = endloop;
                        endloop = NULL;
                        d->ReaderData->AbortOnRead = abort_on_read_at_endloop;
-                       readers_before_endloop = d->ReaderData->ReaderCount;
                        continue;
                }
                rc_for_all_writes_mask(tmp, get_readers_write_callback, d);
index ef8e2bf..bb8d482 100644 (file)
@@ -31,8 +31,6 @@
 
 #include "radeon_program_constants.h"
 
-#include <stdbool.h>
-
 struct radeon_compiler;
 struct rc_instruction;
 struct rc_swizzle_caps;
@@ -93,7 +91,6 @@ struct rc_reader_data {
        unsigned int AbortOnWrite;
        unsigned int LoopDepth;
        unsigned int InElse;
-       bool ReadersAfterEndloop;
        struct rc_instruction * Writer;
 
        unsigned int ReaderCount;
index 5b5d92f..08ac6d2 100644 (file)
@@ -154,7 +154,7 @@ static void copy_propagate(struct radeon_compiler * c, struct rc_instruction * i
                       copy_propagate_scan_read, NULL,
                       is_src_clobbered_scan_write);
 
-       if (reader_data.Abort || reader_data.ReaderCount == 0 || reader_data.ReadersAfterEndloop)
+       if (reader_data.Abort || reader_data.ReaderCount == 0)
                return;
 
        /* We can propagate SaturateMode if all the readers are MOV instructions