Mesa (master): nir/opt_sink: return early when trying to sink unused instructions

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Dec 2 17:29:18 UTC 2020


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

Author: Daniel Schürmann <daniel at schuermann.dev>
Date:   Wed Dec  2 15:34:26 2020 +0100

nir/opt_sink: return early when trying to sink unused instructions

Fixes: 5f6c5e5b86f366c6fe0a0911fdc1926f1e0d1d5f ('nir: don't sink instructions into loops')

Reviewed-by: Rhys Perry <pendingchaos02 at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7874>

---

 src/compiler/nir/nir_opt_sink.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/compiler/nir/nir_opt_sink.c b/src/compiler/nir/nir_opt_sink.c
index 25ce7aaf1fb..e86ca3c0a5d 100644
--- a/src/compiler/nir/nir_opt_sink.c
+++ b/src/compiler/nir/nir_opt_sink.c
@@ -166,6 +166,10 @@ get_preferred_block(nir_ssa_def *def, bool sink_out_of_loops)
       lca = nir_dominance_lca(lca, use_block);
    }
 
+   /* return in case, we didn't find a reachable user */
+   if (!lca)
+      return NULL;
+
    /* We don't sink any instructions into loops to avoid repeated executions
     * This might occasionally increase register pressure, but seems overall
     * the better choice.



More information about the mesa-commit mailing list