summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--share/txr/stdlib/compiler.tl3
-rw-r--r--share/txr/stdlib/optimize.tl7
2 files changed, 7 insertions, 3 deletions
diff --git a/share/txr/stdlib/compiler.tl b/share/txr/stdlib/compiler.tl
index f8b3469e..59050ff5 100644
--- a/share/txr/stdlib/compiler.tl
+++ b/share/txr/stdlib/compiler.tl
@@ -1502,7 +1502,8 @@
(new (frag dreg nil))))))))
(defmeth compiler optimize (me insns)
- (let* ((bb (new (basic-blocks insns))))
+ (let* ((lt-dregs (mapcar .oreg me.lt-frags))
+ (bb (new (basic-blocks insns lt-dregs))))
bb.(calc-liveness)
bb.(peephole)
bb.(thread-jumps)
diff --git a/share/txr/stdlib/optimize.tl b/share/txr/stdlib/optimize.tl
index a2054ca3..fcaece3b 100644
--- a/share/txr/stdlib/optimize.tl
+++ b/share/txr/stdlib/optimize.tl
@@ -37,8 +37,9 @@
links
insns)
- (defstruct (basic-blocks insns) nil
+ (defstruct (basic-blocks insns lt-dregs) nil
insns
+ lt-dregs
root
(hash (hash))
(li-hash (hash :eq-based))
@@ -257,7 +258,9 @@
(while* (nequal ninsn insn)
(set insn ninsn
ninsn (match-case insn
- ((if (d @reg) @jlabel) nil)
+ (@(require (if @(as reg (d @reg)) @jlabel)
+ (not (memqual reg bb.lt-dregs)))
+ nil)
((if (t 0) @jlabel)
^(jmp ,jlabel))
((jmp @jlabel)