Mesa (staging/22.0): microsoft/compiler: Only prep phis for the current function
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Feb 8 05:53:10 UTC 2022
Module: Mesa
Branch: staging/22.0
Commit: c7bd1f0720dbeb32d70aa722c6f5457f5e4a31ab
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=c7bd1f0720dbeb32d70aa722c6f5457f5e4a31ab
Author: Jesse Natalie <jenatali at microsoft.com>
Date: Wed Feb 2 06:57:02 2022 -0800
microsoft/compiler: Only prep phis for the current function
Fixes: 41af9620 ("microsoft/compiler: Emit all NIR functions into the DXIL module")
Reviewed-by: Bill Kristiansen <billkris at microsoft.com>
Reviewed-By: Sil Vilerino <sivileri at microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14837>
(cherry picked from commit 0c711dc823b7db47b615ec7453c9bcba6297e07e)
---
.pick_status.json | 2 +-
src/microsoft/compiler/nir_to_dxil.c | 26 +++++++++++---------------
2 files changed, 12 insertions(+), 16 deletions(-)
diff --git a/.pick_status.json b/.pick_status.json
index c7d8aa2889b..1c00d5a3a3d 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -1075,7 +1075,7 @@
"description": "microsoft/compiler: Only prep phis for the current function",
"nominated": true,
"nomination_type": 1,
- "resolution": 0,
+ "resolution": 1,
"main_sha": null,
"because_sha": "41af96209973c64c02f07d62a3663f93e1183681"
},
diff --git a/src/microsoft/compiler/nir_to_dxil.c b/src/microsoft/compiler/nir_to_dxil.c
index 54db719f200..166ff2da232 100644
--- a/src/microsoft/compiler/nir_to_dxil.c
+++ b/src/microsoft/compiler/nir_to_dxil.c
@@ -5011,7 +5011,7 @@ sort_uniforms_by_binding_and_remove_structs(nir_shader *s)
}
static void
-prepare_phi_values(struct ntd_context *ctx)
+prepare_phi_values(struct ntd_context *ctx, nir_function_impl *impl)
{
/* PHI nodes are difficult to get right when tracking the types:
* Since the incoming sources are linked to blocks, we can't bitcast
@@ -5020,19 +5020,15 @@ prepare_phi_values(struct ntd_context *ctx)
* value has a different type then the one expected by the phi node.
* We choose int as default, because it supports more bit sizes.
*/
- nir_foreach_function(function, ctx->shader) {
- if (function->impl) {
- nir_foreach_block(block, function->impl) {
- nir_foreach_instr(instr, block) {
- if (instr->type == nir_instr_type_phi) {
- nir_phi_instr *ir = nir_instr_as_phi(instr);
- unsigned bitsize = nir_dest_bit_size(ir->dest);
- const struct dxil_value *dummy = dxil_module_get_int_const(&ctx->mod, 0, bitsize);
- nir_foreach_phi_src(src, ir) {
- for(unsigned int i = 0; i < ir->dest.ssa.num_components; ++i)
- store_ssa_def(ctx, src->src.ssa, i, dummy);
- }
- }
+ nir_foreach_block(block, impl) {
+ nir_foreach_instr(instr, block) {
+ if (instr->type == nir_instr_type_phi) {
+ nir_phi_instr *ir = nir_instr_as_phi(instr);
+ unsigned bitsize = nir_dest_bit_size(ir->dest);
+ const struct dxil_value *dummy = dxil_module_get_int_const(&ctx->mod, 0, bitsize);
+ nir_foreach_phi_src(src, ir) {
+ for(unsigned int i = 0; i < ir->dest.ssa.num_components; ++i)
+ store_ssa_def(ctx, src->src.ssa, i, dummy);
}
}
}
@@ -5163,7 +5159,7 @@ emit_function(struct ntd_context *ctx, nir_function *func)
if (!ctx->phis)
return false;
- prepare_phi_values(ctx);
+ prepare_phi_values(ctx, impl);
if (!emit_scratch(ctx))
return false;
More information about the mesa-commit
mailing list