diff options
author | Timothy Arceri <[email protected]> | 2018-06-04 16:26:46 +1000 |
---|---|---|
committer | Timothy Arceri <[email protected]> | 2018-06-30 10:13:03 +1000 |
commit | 463f849097193ad20e7622ddd740fd15b96f4277 (patch) | |
tree | 81460ee57bb8f946e0620257d6188add2f43e834 /src/compiler/nir/nir_loop_analyze.c | |
parent | 18293be62282b5f02ffabccdb8597a3e217b55e8 (diff) |
nir: fix selection of loop terminator when two or more have the same limit
We need to add loop terminators to the list in the order we come
across them otherwise if two or more have the same exit condition
we will select that last one rather than the first one even though
its unreachable.
This fix is for simple unrolls where we only have a single exit
point. When unrolling these type of loops the unreachable
terminators and their unreachable branch are removed prior to
unrolling. Because of the logic change we also switch some
list access in the complex unrolling logic to avoid breakage.
Fixes: 6772a17acc8e ("nir: Add a loop analysis pass")
Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src/compiler/nir/nir_loop_analyze.c')
-rw-r--r-- | src/compiler/nir/nir_loop_analyze.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/compiler/nir/nir_loop_analyze.c b/src/compiler/nir/nir_loop_analyze.c index 438e1fac3ea..d564296aa67 100644 --- a/src/compiler/nir/nir_loop_analyze.c +++ b/src/compiler/nir/nir_loop_analyze.c @@ -330,8 +330,8 @@ find_loop_terminators(loop_info_state *state) nir_loop_terminator *terminator = rzalloc(state->loop->info, nir_loop_terminator); - list_add(&terminator->loop_terminator_link, - &state->loop->info->loop_terminator_list); + list_addtail(&terminator->loop_terminator_link, + &state->loop->info->loop_terminator_list); terminator->nif = nif; terminator->break_block = break_blk; |