From df63481b5964133ee7853eef47a35da190219a7b Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Mon, 29 Nov 2021 07:12:49 -0800 Subject: compiler: revise no-longer-matching late peephole case. * stdlib/optimize.tl (basic-blocks late-peephole): This pattern doesn't match any more because of code removed by the previous commit. If we shorten it by removing the lab1 block, then it matches. Because the pattern is shorter, the reduction being performed by the replacement is no longer needed; it has already been done. The remaining value is that threads the jump from lab3 to lab4. This missing threading is what I noticed when evaluating the effects of the previous patch; this restores it. --- stdlib/optimize.tl | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/stdlib/optimize.tl b/stdlib/optimize.tl index 2274e424..a8e4ba9d 100644 --- a/stdlib/optimize.tl +++ b/stdlib/optimize.tl @@ -600,26 +600,15 @@ ,lab1 ,*rest)))) (((mov (t @tn) (d @dn)) - (jmp @lab3) - @lab1 - (mov (t @tn) (t 0)) (jmp @lab3) @lab2 (mov (t @tn) (t 0)) @(symbolp @lab3) (ifq (t @tn) (t 0) @lab4) . @rest) - (let ((lab5 (gensym "nl"))) - ^((mov (t ,tn) (d ,dn)) - (jmp ,lab4) - ,lab1 - ,lab2 - (mov (t ,tn) (t 0)) - (jmp ,lab5) - ,lab3 - (ifq (t ,tn) (t 0) ,lab4) - ,lab5 - ,*rest))) + ^(,(car insns) + (jmp ,lab4) + ,*(cddr insns))) (((mov (t @tx) (t @ty)) (if (t @ty) @lab2) @(symbolp @lab1) -- cgit v1.2.3