wingo pushed a commit to branch main
in repository guile.
commit e7e625b7731c29f1777dd670381ef374588c26d0
Author: Andy Wingo <[email protected]>
AuthorDate: Thu Jun 22 14:34:49 2023 +0200
Fix effects analysis bug for synthesized definitions at allocations
* module/language/cps/effects-analysis.scm (compute-known-allocations):
For a primcall that allocates, sometimes we will synthesize auxiliary
definitions as part of CSE, for example to indicate that if (cons x y)
is bound to z, that a later call to (car z) should give x unless there
might be an intervening set-car!. We had a bug in which aux definitions
attached to allocations were being incorrectly associated with the first
operand. Probably this is a bug in other contexts but it really starts
to hit with the high-level constructors, e.g. `box`.
---
module/language/cps/effects-analysis.scm | 1 +
1 file changed, 1 insertion(+)
diff --git a/module/language/cps/effects-analysis.scm
b/module/language/cps/effects-analysis.scm
index c6439cfd1..3e81c3eb4 100644
--- a/module/language/cps/effects-analysis.scm
+++ b/module/language/cps/effects-analysis.scm
@@ -268,6 +268,7 @@ loads from objects created at known allocation sites."
(lambda (label fx out)
(cond
((causes-all-effects? fx) out)
+ ((logtest fx &allocation) out)
((logtest fx (logior &read &write))
(match (intmap-ref conts label)
;; Assume that instructions which cause a known set of effects