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

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

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7874>
This commit is contained in:
Daniel Schürmann 2020-12-02 15:34:26 +01:00 committed by Marge Bot
parent 5603bb13e3
commit e60fcf0a87

View file

@ -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.