Mesa (staging/22.1): nir: Remove single-source phis before opt_if_loop_last_continue

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Apr 27 19:30:40 UTC 2022


Module: Mesa
Branch: staging/22.1
Commit: 07a0e16324adc79cdc8888776b232b42fb5a815e
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=07a0e16324adc79cdc8888776b232b42fb5a815e

Author: Yevhenii Kolesnikov <yevhenii.kolesnikov at globallogic.com>
Date:   Thu Apr 21 21:20:13 2022 +0300

nir: Remove single-source phis before opt_if_loop_last_continue

We might have some single-source phis leftover after prior optimizations. We
want to get rid of them before merging the blocks.

Fixes: 5921a19d4b0 ("nir: add if opt opt_if_loop_last_continue()")

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6312

Signed-off-by: Yevhenii Kolesnikov <yevhenii.kolesnikov at globallogic.com>
Reviewed-by: Danylo Piliaiev <dpiliaiev at igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16095>
(cherry picked from commit 65caf46b3b827f4cf5a32972ca5844c69e598aa6)

---

 .pick_status.json             | 2 +-
 src/compiler/nir/nir_opt_if.c | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/.pick_status.json b/.pick_status.json
index cc8342e9489..5ce95d492b3 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -616,7 +616,7 @@
         "description": "nir: Remove single-source phis before opt_if_loop_last_continue",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": "5921a19d4b0c6491b3535b5154d585384c9ea144"
     },
diff --git a/src/compiler/nir/nir_opt_if.c b/src/compiler/nir/nir_opt_if.c
index f72451faa2f..2327e1c07e3 100644
--- a/src/compiler/nir/nir_opt_if.c
+++ b/src/compiler/nir/nir_opt_if.c
@@ -818,6 +818,11 @@ opt_if_loop_last_continue(nir_loop *loop, bool aggressive_last_continue)
        exec_list_is_empty(&last_block->instr_list))
       return false;
 
+   /* If there are single-source phis in the last block,
+    * get rid of them first
+    */
+   nir_opt_remove_phis_block(last_block);
+
    /* Move the last block of the loop inside the last if-statement */
    nir_cf_list tmp;
    nir_cf_extract(&tmp, nir_after_cf_node(if_node),



More information about the mesa-commit mailing list