Mesa (master): nir/liveness: Consider if uses in nir_ssa_defs_interfere

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Sep 25 14:33:00 UTC 2020


Module: Mesa
Branch: master
Commit: 0206fb39418786e069088c513bf392d564d3d0f9
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=0206fb39418786e069088c513bf392d564d3d0f9

Author: Jason Ekstrand <jason at jlekstrand.net>
Date:   Tue Sep 22 16:56:42 2020 -0500

nir/liveness: Consider if uses in nir_ssa_defs_interfere

Fixes: f86902e75d9 "nir: Add an SSA-based liveness analysis pass"
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3428
Reviewed-by: Eric Anholt <eric at anholt.net>
Reviewed-by: Yevhenii Kharchenko <yevhenii.kharchenko at globallogic.com>
Reviewed-by: Connor Abbott <cwabbott0 at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6824>

---

 src/compiler/nir/nir_liveness.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/compiler/nir/nir_liveness.c b/src/compiler/nir/nir_liveness.c
index d8f33c2d0ea..9b9df10e66d 100644
--- a/src/compiler/nir/nir_liveness.c
+++ b/src/compiler/nir/nir_liveness.c
@@ -250,6 +250,15 @@ search_for_use_after_instr(nir_instr *start, nir_ssa_def *def)
          return true;
       node = node->next;
    }
+
+   /* If uses are considered to be in the block immediately preceding the if
+    * so we need to also check the following if condition, if any.
+    */
+   nir_if *following_if = nir_block_get_following_if(start->block);
+   if (following_if && following_if->condition.is_ssa &&
+       following_if->condition.ssa == def)
+      return true;
+
    return false;
 }
 



More information about the mesa-commit mailing list