mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-04-30 21:21:39 +02:00
ir3/legalize: Fix loop convergence behavior
This prevents the previous commit from being undone by the jump optimizations in legalize, and fixes another potential case where instead of a continue we have an if/else at the end of a loop. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6752>
This commit is contained in:
parent
0fa93fb662
commit
75516e0595
1 changed files with 14 additions and 1 deletions
|
|
@ -467,8 +467,17 @@ resolve_dest_block(struct ir3_block *block)
|
|||
} else if (list_length(&block->instr_list) == 1) {
|
||||
struct ir3_instruction *instr = list_first_entry(
|
||||
&block->instr_list, struct ir3_instruction, node);
|
||||
if (instr->opc == OPC_JUMP)
|
||||
if (instr->opc == OPC_JUMP) {
|
||||
/* If this jump is backwards, then we will probably convert
|
||||
* the jump being resolved to a backwards jump, which will
|
||||
* change a loop-with-continue or loop-with-if into a
|
||||
* doubly-nested loop and change the convergence behavior.
|
||||
* Disallow this here.
|
||||
*/
|
||||
if (block->successors[0]->index <= block->index)
|
||||
return block;
|
||||
return block->successors[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
return block;
|
||||
|
|
@ -523,6 +532,10 @@ opt_jump(struct ir3 *ir)
|
|||
{
|
||||
bool progress = false;
|
||||
|
||||
unsigned index = 0;
|
||||
foreach_block (block, &ir->block_list)
|
||||
block->index = index++;
|
||||
|
||||
foreach_block (block, &ir->block_list) {
|
||||
foreach_instr (instr, &block->instr_list) {
|
||||
if (!is_flow(instr) || !instr->cat0.target)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue