From d85da8e7696cda9e6bd441c13371dcad5753785d Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sun, 16 Apr 2023 21:21:36 -0700 Subject: compiler: bugfix: wrong propagation into close insn. * stdlib/optimize.tl (basic-blocks rename): When we encounter a close instruction, we must leave it alone. The registers named in the argument area of the instruction do not belong to the current instruction stream or basic block; they belong to the function body. --- stdlib/optimize.tl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'stdlib') diff --git a/stdlib/optimize.tl b/stdlib/optimize.tl index 24cad22f..089b1334 100644 --- a/stdlib/optimize.tl +++ b/stdlib/optimize.tl @@ -363,8 +363,10 @@ (defmeth basic-blocks rename (bb insns dst src) (build (whilet ((insn (pop insns))) - (let ((li [bb.li-hash insn])) + (let ((close (if-match (close . @nil) insn t)) + (li [bb.li-hash insn])) (cond + (close (add insn)) ((or (mequal li.def0 dst src) (mequal li.def1 dst src)) (add insn) -- cgit v1.2.3