ir3: Insert output collects in the main shader

We were inserting them in what was NIR's end block with the "end"
instruction, which meant that the moves they generated couldn't be
scheduled with the rest of the last block as part of post-RA scheduling.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9842>
This commit is contained in:
Connor Abbott 2021-03-04 12:21:50 +01:00 committed by Emma Anholt
parent fa17295ebd
commit a61a9cd65d

View file

@ -3882,6 +3882,15 @@ ir3_compile_shader_nir(struct ir3_compiler *compiler,
struct ir3_instruction *outputs[ctx->noutputs / 4];
unsigned outputs_count = 0;
struct ir3_block *old_block = ctx->block;
/* Insert these collect's in the block before the end-block if
* possible, so that any moves they generate can be shuffled around to
* reduce nop's:
*/
if (ctx->block->predecessors_count == 1)
ctx->block = ctx->block->predecessors[0];
/* Setup IR level outputs, which are "collects" that gather
* the scalar components of outputs.
*/
@ -3943,6 +3952,8 @@ ir3_compile_shader_nir(struct ir3_compiler *compiler,
}
}
ctx->block = old_block;
struct ir3_instruction *end = ir3_instr_create(ctx->block, OPC_END,
outputs_count + 1);