intel/fs: Move defin/defout setup to the start of the loop.
authorEmma Anholt <emma@anholt.net>
Tue, 13 Jun 2023 23:14:50 +0000 (16:14 -0700)
committerMarge Bot <emma+marge@anholt.net>
Tue, 22 Aug 2023 23:34:30 +0000 (23:34 +0000)
Refactor for the next commit.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24702>

src/intel/compiler/brw_fs_live_variables.cpp

index d6731d77a80ac9e72afe164a4b487cc35df206f9..fa74fc2cccd54f630dd018832bd850b7606e5a0d 100644 (file)
@@ -156,7 +156,29 @@ fs_live_variables::compute_live_variables()
 {
    bool cont = true;
 
-   while (cont) {
+   /* Propagate defin and defout down the CFG to calculate the union of live
+    * variables potentially defined along any possible control flow path.
+    */
+   do {
+      cont = false;
+
+      foreach_block (block, cfg) {
+         const struct block_data *bd = &block_data[block->num];
+
+         foreach_list_typed(bblock_link, child_link, link, &block->children) {
+            struct block_data *child_bd = &block_data[child_link->block->num];
+
+            for (int i = 0; i < bitset_words; i++) {
+               const BITSET_WORD new_def = bd->defout[i] & ~child_bd->defin[i];
+               child_bd->defin[i] |= new_def;
+               child_bd->defout[i] |= new_def;
+               cont |= new_def;
+            }
+         }
+      }
+   } while (cont);
+
+   do {
       cont = false;
 
       foreach_block_reverse (block, cfg) {
@@ -200,28 +222,6 @@ fs_live_variables::compute_live_variables()
             cont = true;
          }
       }
-   }
-
-   /* Propagate defin and defout down the CFG to calculate the union of live
-    * variables potentially defined along any possible control flow path.
-    */
-   do {
-      cont = false;
-
-      foreach_block (block, cfg) {
-         const struct block_data *bd = &block_data[block->num];
-
-         foreach_list_typed(bblock_link, child_link, link, &block->children) {
-            struct block_data *child_bd = &block_data[child_link->block->num];
-
-            for (int i = 0; i < bitset_words; i++) {
-               const BITSET_WORD new_def = bd->defout[i] & ~child_bd->defin[i];
-               child_bd->defin[i] |= new_def;
-               child_bd->defout[i] |= new_def;
-               cont |= new_def;
-            }
-         }
-      }
    } while (cont);
 }