mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-01 23:18:20 +02:00
pan/bi: Consider flow control in DCE
We don't want to remove instructions like `NOP.wait` on Valhall; this would be tantamount to deleting barriers. Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15793>
This commit is contained in:
parent
6e69c3369c
commit
2b57303eaf
3 changed files with 13 additions and 7 deletions
|
|
@ -55,7 +55,7 @@ bi_opt_dead_code_eliminate(bi_context *ctx)
|
|||
all_null &= bi_is_null(ins->dest[d]);
|
||||
}
|
||||
|
||||
if (all_null && !bi_side_effects(ins->op))
|
||||
if (all_null && !bi_side_effects(ins))
|
||||
bi_remove_instruction(ins);
|
||||
else
|
||||
bi_liveness_ins_update(live, ins, temp_count);
|
||||
|
|
|
|||
|
|
@ -156,12 +156,18 @@ bi_next_clause(bi_context *ctx, bi_block *block, bi_clause *clause)
|
|||
* implies no loss of generality */
|
||||
|
||||
bool
|
||||
bi_side_effects(enum bi_opcode op)
|
||||
bi_side_effects(const bi_instr *I)
|
||||
{
|
||||
if (bi_opcode_props[op].last)
|
||||
if (bi_opcode_props[I->op].last)
|
||||
return true;
|
||||
|
||||
switch (op) {
|
||||
/* On Valhall, nontrivial flow control acts as a side effect and should
|
||||
* not be dead code eliminated away.
|
||||
*/
|
||||
if (I->flow)
|
||||
return true;
|
||||
|
||||
switch (I->op) {
|
||||
case BI_OPCODE_DISCARD_F32:
|
||||
case BI_OPCODE_DISCARD_B32:
|
||||
return true;
|
||||
|
|
@ -169,7 +175,7 @@ bi_side_effects(enum bi_opcode op)
|
|||
break;
|
||||
}
|
||||
|
||||
switch (bi_opcode_props[op].message) {
|
||||
switch (bi_opcode_props[I->op].message) {
|
||||
case BIFROST_MESSAGE_NONE:
|
||||
case BIFROST_MESSAGE_VARYING:
|
||||
case BIFROST_MESSAGE_ATTRIBUTE:
|
||||
|
|
@ -189,7 +195,7 @@ bi_side_effects(enum bi_opcode op)
|
|||
return true;
|
||||
|
||||
case BIFROST_MESSAGE_TILE:
|
||||
return (op != BI_OPCODE_LD_TILE);
|
||||
return (I->op != BI_OPCODE_LD_TILE);
|
||||
}
|
||||
|
||||
unreachable("Invalid message type");
|
||||
|
|
|
|||
|
|
@ -1016,7 +1016,7 @@ unsigned bi_count_write_registers(const bi_instr *ins, unsigned dest);
|
|||
bool bi_is_regfmt_16(enum bi_register_format fmt);
|
||||
unsigned bi_writemask(const bi_instr *ins, unsigned dest);
|
||||
bi_clause * bi_next_clause(bi_context *ctx, bi_block *block, bi_clause *clause);
|
||||
bool bi_side_effects(enum bi_opcode op);
|
||||
bool bi_side_effects(const bi_instr *I);
|
||||
bool bi_reconverge_branches(bi_block *block);
|
||||
|
||||
void bi_print_instr(const bi_instr *I, FILE *fp);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue