pan/bi: Don't write registers in optimizer tests

The new SSA-based dead code elimination won't know how to deal with code of that
funny form. In actuality it doesn't have to, so we just make sure the optimizer
tests produce valid IR so this works as expected.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17794>
This commit is contained in:
Alyssa Rosenzweig 2022-07-26 13:22:17 -04:00 committed by Marge Bot
parent e68b7531ca
commit 29f53ee8bb
2 changed files with 9 additions and 4 deletions

View file

@ -6195,7 +6195,7 @@
<src start="6" mask="0xf7"/>
</ins>
<ins name="+KABOOM" mask="0xffff8" exact="0xd7858" unused="true" message="job_management">
<ins name="+KABOOM" mask="0xffff8" exact="0xd7858" message="job" dests="0">
<src start="0"/>
</ins>

View file

@ -35,7 +35,14 @@ bi_optimizer(bi_context *ctx)
bi_opt_dead_code_eliminate(ctx);
}
#define CASE(instr, expected) INSTRUCTION_CASE(instr, expected, bi_optimizer)
/* Define reg first so it has a consistent variable index, and pass it to an
* instruction that cannot be dead code eliminated so the program is nontrivial.
*/
#define CASE(instr, expected) INSTRUCTION_CASE(\
{ UNUSED bi_index reg = bi_temp(b->shader); instr; bi_kaboom(b, reg); }, \
{ UNUSED bi_index reg = bi_temp(b->shader); expected; bi_kaboom(b, reg); }, \
bi_optimizer);
#define NEGCASE(instr) CASE(instr, instr)
class Optimizer : public testing::Test {
@ -43,7 +50,6 @@ protected:
Optimizer() {
mem_ctx = ralloc_context(NULL);
reg = bi_register(0);
x = bi_register(1);
y = bi_register(2);
negabsx = bi_neg(bi_abs(x));
@ -55,7 +61,6 @@ protected:
void *mem_ctx;
bi_index reg;
bi_index x;
bi_index y;
bi_index negabsx;