diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2023-08-04 06:59:02 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2023-08-04 06:59:02 -0700 |
commit | ce4b9b23a2faf3a7fa5dff032b934b3ded7d39c7 (patch) | |
tree | 787a4288566f31427402a2204689a09e4b4b8b93 /stdlib | |
parent | 22ad3ca92d11b413d76c8cf7d64e3d7cca9b3c85 (diff) | |
download | txr-ce4b9b23a2faf3a7fa5dff032b934b3ded7d39c7.tar.gz txr-ce4b9b23a2faf3a7fa5dff032b934b3ded7d39c7.tar.bz2 txr-ce4b9b23a2faf3a7fa5dff032b934b3ded7d39c7.zip |
compiler: bug: constant folding load-time dregs.
The optimizer eliminates calls to pure library functions when
all their arguments are D-registers. The call is made at
compiled time and its value is inserted into the program
as a constant (in a newly allocated D register).
The bug is that we can't do this for a D register that
is linked to a load-time value, because we don't know its
value until run-time.
* stdlib/optimize.tl (basic-blocks do-peephole-block): Add
a constraint that none of the D registers can be a member
of bb.lt-dregs, which holds the list of D registers that
are used for load-time values.
Diffstat (limited to 'stdlib')
-rw-r--r-- | stdlib/optimize.tl | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/stdlib/optimize.tl b/stdlib/optimize.tl index a16403b9..702a4252 100644 --- a/stdlib/optimize.tl +++ b/stdlib/optimize.tl @@ -539,7 +539,8 @@ . @(all @(or (d @dn) @(with (t 0) dn nil)))) . @rest) - [%const-foldable% [bb.symvec idx]]) + [%const-foldable% [bb.symvec idx]] + [none dn (lop member bb.lt-dregs : cadr)]) (let* ((co bb.compiler) (dvec co.(get-datavec)) (fun [bb.symvec idx]) |