nv50/peephole: merge/split can swap word order

and we would prevoisly incorrectly apply MergeSplits in this case

That is,
    a, b = split(x)
    y = merge(b, a)
could be incorrectly optimized to
    y = x
before this commit

Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24984>
This commit is contained in:
M Henning 2023-02-18 23:38:58 -05:00 committed by Marge Bot
parent 71ca8529c5
commit 879343839b

View file

@ -137,6 +137,8 @@ MergeSplits::visit(BasicBlock *bb)
si = i->getSrc(0)->getInsn();
if (si->op != OP_SPLIT || si != i->getSrc(1)->getInsn())
continue;
if (i->getSrc(0) != si->getDef(0) || i->getSrc(1) != si->getDef(1))
continue;
i->def(0).replace(si->getSrc(0), false);
delete_Instruction(prog, i);
}