ir3: use physical cfg in helper_sched

We used the logical cfg in helper_sched under the assumption that (eq)
only kills active helpers. This could lead to something like this:

br p0.x, else
sam
(eq)nop
jump end
else:
sam
end:

It turns out this is not correct: (eq) kills *all* helpers so the
snippet above could produce wrong results.

To fix this, simply switch from using the logical cfg in helper_sched to
using the physical cfg.

Signed-off-by: Job Noorman <jnoorman@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29409>
This commit is contained in:
Job Noorman 2024-08-16 15:54:24 +02:00 committed by Marge Bot
parent 1bbc36c5d2
commit 97d049504c

View file

@ -1480,8 +1480,8 @@ helper_sched(struct ir3_legalize_ctx *ctx, struct ir3 *ir,
if (!bd->uses_helpers_beginning)
continue;
for (unsigned i = 0; i < block->predecessors_count; i++) {
struct ir3_block *pred = block->predecessors[i];
for (unsigned i = 0; i < block->physical_predecessors_count; i++) {
struct ir3_block *pred = block->physical_predecessors[i];
struct ir3_helper_block_data *pred_bd = pred->data;
if (!pred_bd->uses_helpers_end) {
pred_bd->uses_helpers_end = true;
@ -1548,8 +1548,8 @@ helper_sched(struct ir3_legalize_ctx *ctx, struct ir3 *ir,
* helper invocations.
*/
bool pred_uses_helpers = bd->uses_helpers_beginning;
for (unsigned i = 0; i < block->predecessors_count; i++) {
struct ir3_block *pred = block->predecessors[i];
for (unsigned i = 0; i < block->physical_predecessors_count; i++) {
struct ir3_block *pred = block->physical_predecessors[i];
struct ir3_helper_block_data *pred_bd = pred->data;
if (pred_bd->uses_helpers_end) {
pred_uses_helpers = true;