cptypes: fix reduction of $value in ignored expressions

original commit: 858cc5fe0f40e73a3473e3cc3f506c2c232c0a81
This commit is contained in:
Gustavo Massaccesi 2020-04-01 18:59:22 -03:00
parent f828cb1eaa
commit 5c91b7f9ac
2 changed files with 11 additions and 0 deletions

View File

@ -1106,4 +1106,9 @@
(cptypes/once-equivalent-expansion?
'(vector? (list 1 (vector 2 (display 3) 4)))
'(begin (display 3) #f))
; regression test: check that the compiler doesn't loop forever
; when the return arity is unknown
(cptypes-equivalent-expansion?
'(lambda (f) (box? (box (f))))
'(lambda (f) (#3%$value (f)) #t))
)

View File

@ -173,6 +173,12 @@ Notes:
`(if ,e1 ,e2 ,e3)])]
[(case-lambda ,preinfo ,cl* ...)
void-rec]
[(call ,preinfo ,pr ,e)
(guard (eq? (primref-name pr) '$value))
(cond
[(single-valued? e)
(make-seq 'effect e void-rec)]
[else ir])]
[(call ,preinfo ,pr ,e* ...)
(let ([flags (primref-flags pr)])
(cond