mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-05 04:40:11 +01:00
nir/loop_analyze: use a sparse array and stop indexing SSA defs
Indexing SSA defs is unexpected behaviour and interferes with using nir_loop_analyze_impl for validation. It probably also breaks nir_metadata_live_defs. 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/32005>
This commit is contained in:
parent
77118fcf72
commit
36840db6fe
1 changed files with 5 additions and 5 deletions
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
#include "nir_loop_analyze.h"
|
||||
#include "util/bitset.h"
|
||||
#include "util/sparse_array.h"
|
||||
#include "nir.h"
|
||||
#include "nir_constant_expressions.h"
|
||||
|
||||
|
|
@ -69,7 +70,7 @@ typedef struct {
|
|||
nir_loop *loop;
|
||||
|
||||
/* Loop_variable for all ssa_defs in function */
|
||||
nir_loop_variable *loop_vars;
|
||||
struct util_sparse_array loop_vars;
|
||||
BITSET_WORD *loop_vars_init;
|
||||
|
||||
/* A list of the loop_vars to analyze */
|
||||
|
|
@ -83,7 +84,7 @@ typedef struct {
|
|||
static nir_loop_variable *
|
||||
get_loop_var(nir_def *value, loop_info_state *state)
|
||||
{
|
||||
nir_loop_variable *var = &(state->loop_vars[value->index]);
|
||||
nir_loop_variable *var = util_sparse_array_get(&state->loop_vars, value->index);
|
||||
|
||||
if (!BITSET_TEST(state->loop_vars_init, value->index)) {
|
||||
var->in_loop = false;
|
||||
|
|
@ -1554,8 +1555,7 @@ initialize_loop_info_state(nir_loop *loop, void *mem_ctx,
|
|||
nir_function_impl *impl)
|
||||
{
|
||||
loop_info_state *state = rzalloc(mem_ctx, loop_info_state);
|
||||
state->loop_vars = ralloc_array(mem_ctx, nir_loop_variable,
|
||||
impl->ssa_alloc);
|
||||
util_sparse_array_init(&state->loop_vars, sizeof(nir_loop_variable), 128);
|
||||
state->loop_vars_init = rzalloc_array(mem_ctx, BITSET_WORD,
|
||||
BITSET_WORDS(impl->ssa_alloc));
|
||||
state->loop = loop;
|
||||
|
|
@ -1609,6 +1609,7 @@ process_loops(nir_cf_node *cf_node, nir_variable_mode indirect_mask,
|
|||
|
||||
get_loop_info(state, impl);
|
||||
|
||||
util_sparse_array_finish(&state->loop_vars);
|
||||
ralloc_free(mem_ctx);
|
||||
}
|
||||
|
||||
|
|
@ -1617,7 +1618,6 @@ nir_loop_analyze_impl(nir_function_impl *impl,
|
|||
nir_variable_mode indirect_mask,
|
||||
bool force_unroll_sampler_indirect)
|
||||
{
|
||||
nir_index_ssa_defs(impl);
|
||||
foreach_list_typed(nir_cf_node, node, node, &impl->body)
|
||||
process_loops(node, indirect_mask, force_unroll_sampler_indirect);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue