summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Ekstrand <jason@jlekstrand.net>2020-09-22 16:56:42 -0500
committerEric Engestrom <eric@engestrom.ch>2020-09-27 11:11:31 +0200
commit083b992f9d9552b164b2bdd2e7a7f239498db491 (patch)
tree20f3575bce052fdaef9afea917a5569137f848b3
parent520d023bfb256dd0e90f3dde96c6920682290243 (diff)
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@anholt.net> Reviewed-by: Yevhenii Kharchenko <yevhenii.kharchenko@globallogic.com> Reviewed-by: Connor Abbott <cwabbott0@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6824> (cherry picked from commit 0206fb39418786e069088c513bf392d564d3d0f9)
-rw-r--r--.pick_status.json2
-rw-r--r--src/compiler/nir/nir_liveness.c9
2 files changed, 10 insertions, 1 deletions
diff --git a/.pick_status.json b/.pick_status.json
index c4fe0a8f095..1eb43b0f80f 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -301,7 +301,7 @@
"description": "nir/liveness: Consider if uses in nir_ssa_defs_interfere",
"nominated": true,
"nomination_type": 1,
- "resolution": 0,
+ "resolution": 1,
"master_sha": null,
"because_sha": "f86902e75d989b781be36ced5dc98dfc0cd34b7b"
},
diff --git a/src/compiler/nir/nir_liveness.c b/src/compiler/nir/nir_liveness.c
index 16dbeb4a223..c3c181b3263 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;
}