diff options
author | Rhys Perry <pendingchaos02@gmail.com> | 2021-03-24 14:56:48 +0000 |
---|---|---|
committer | Marge Bot <eric+marge@anholt.net> | 2021-06-04 14:14:00 +0000 |
commit | 49add985ffbfdc44d5865f04ebcb05dbabb88a51 (patch) | |
tree | dd9a2d4f213930dbdc5f734b3ca87d1710123c6b /src/compiler | |
parent | aebffc241dd60807e43d4ec064cc81beff6a1a1b (diff) |
nir/unsigned_upper_bound: don't require dominance metadata
Instead, determine if it's a merge or loop exit phi.
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9808>
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/nir/nir_opt_offsets.c | 3 | ||||
-rw-r--r-- | src/compiler/nir/nir_range_analysis.c | 10 |
2 files changed, 2 insertions, 11 deletions
diff --git a/src/compiler/nir/nir_opt_offsets.c b/src/compiler/nir/nir_opt_offsets.c index 4047ee5daae..88b7b2a2862 100644 --- a/src/compiler/nir/nir_opt_offsets.c +++ b/src/compiler/nir/nir_opt_offsets.c @@ -51,9 +51,6 @@ try_extract_const_addition(nir_builder *b, nir_instr *instr, opt_offsets_state * state->range_ht = _mesa_pointer_hash_table_create(NULL); } - /* Dominance metadata is needed by nir_unsigned_upper_bound to chase phis */ - nir_metadata_require(b->impl, nir_metadata_dominance); - /* Check if there can really be an unsigned wrap. */ nir_ssa_scalar src0 = {alu->src[0].src.ssa, 0}; nir_ssa_scalar src1 = {alu->src[1].src.ssa, 0}; diff --git a/src/compiler/nir/nir_range_analysis.c b/src/compiler/nir/nir_range_analysis.c index 1d7eb99283e..6936b49c9de 100644 --- a/src/compiler/nir/nir_range_analysis.c +++ b/src/compiler/nir/nir_range_analysis.c @@ -1402,16 +1402,10 @@ nir_unsigned_upper_bound(nir_shader *shader, struct hash_table *range_ht, } if (scalar.def->parent_instr->type == nir_instr_type_phi) { - bool cyclic = false; - nir_foreach_phi_src(src, nir_instr_as_phi(scalar.def->parent_instr)) { - if (nir_block_dominates(scalar.def->parent_instr->block, src->pred)) { - cyclic = true; - break; - } - } + nir_cf_node *prev = nir_cf_node_prev(&scalar.def->parent_instr->block->cf_node); uint32_t res = 0; - if (cyclic) { + if (!prev || prev->type == nir_cf_node_block) { _mesa_hash_table_insert(range_ht, key, (void*)(uintptr_t)max); struct set *visited = _mesa_pointer_set_create(NULL); |