diff --git a/module/language/cps/compile-bytecode.scm b/module/language/cps/compile-bytecode.scm index f0df551d2..19e464e46 100644 --- a/module/language/cps/compile-bytecode.scm +++ b/module/language/cps/compile-bytecode.scm @@ -421,7 +421,17 @@ (unless (eq? kf next-label) (emit-br asm kf))))) (match exp - (($ $values (sym)) (unary emit-br-if-true sym)) + (($ $values (sym)) + (call-with-values (lambda () + (lookup-maybe-constant-value sym allocation)) + (lambda (has-const? val) + (if has-const? + (if val + (unless (eq? kt next-label) + (emit-br asm kt)) + (unless (eq? kf next-label) + (emit-br asm kf))) + (unary emit-br-if-true sym))))) (($ $primcall 'null? (a)) (unary emit-br-if-null a)) (($ $primcall 'nil? (a)) (unary emit-br-if-nil a)) (($ $primcall 'pair? (a)) (unary emit-br-if-pair a)) diff --git a/module/language/cps/dfg.scm b/module/language/cps/dfg.scm index d6cfcf38c..b48dbec2b 100644 --- a/module/language/cps/dfg.scm +++ b/module/language/cps/dfg.scm @@ -846,7 +846,7 @@ (lambda (use) (match (find-expression (lookup-cont use conts)) (($ $call) #f) - (($ $values (_ _ . _)) #f) + (($ $values) #f) (($ $primcall 'free-ref (closure slot)) (not (eq? sym slot))) (($ $primcall 'free-set! (closure slot value))