From a6e3a7aabd3563120afdac87d1788e891a359ced Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Mon, 10 Apr 2023 00:49:55 -0700 Subject: compiler: buggy t-reg move peephole case. * stdlib/optimize.tl (basic-blocks do-peephole-block): In the unnecessary copying t-reg case, let's just stay away from doing it if the source operand is a v-reg. It breaks under the recent "eval order of variables" commit, indicating that the conditions that it uses for replacing a v-reg with the t-reg are not correct. The most likely reason is that the v-reg can be assigned, but this doesn't show up in the liveness info which tracks only t-regs. --- stdlib/optimize.tl | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/stdlib/optimize.tl b/stdlib/optimize.tl index 8651db00..7b495617 100644 --- a/stdlib/optimize.tl +++ b/stdlib/optimize.tl @@ -390,9 +390,7 @@ ;; unnecessary copying t-reg (@(require ((mov @(as dst (t @n)) @src) . @rest) (only-locally-used-treg (car insns) n) - (or (neq (car src) 'v) - (none rest [andf [chain car (op eq 'end)] - [chain bb.li-hash .used (lop bit n)]])) + (neq (car src) 'v) (not (find dst rest : [chain bb.li-hash .def])) (not (find src rest : [chain bb.li-hash .def]))) (pushnew bl bb.rescan) -- cgit v1.2.3