cp0: reduce (if <boolean> #t #f)
It may help to reduce expressions like (and <boolean> <obviously-true>) original commit: bf6d3134a306f0cf12768f344d647ceaf820e9fa
This commit is contained in:
parent
2efa342323
commit
8796743cbd
|
@ -316,7 +316,7 @@
|
|||
(equivalent-expansion?
|
||||
(parameterize ([optimize-level 2] [enable-cp0 #t] [#%$suppress-primitive-inlining #f])
|
||||
(expand/optimize '(if (begin (set! x y) (if (begin (set! z y) (zero? h)) #t #f)) e1 e2)))
|
||||
'(begin (set! x y) (if (begin (set! z y) (#2%zero? h)) e1 e2)))
|
||||
'(if (begin (set! x y) (set! z y) (#2%zero? h)) e1 e2))
|
||||
|
||||
(equivalent-expansion?
|
||||
(parameterize ([optimize-level 2] [enable-cp0 #t] [#%$suppress-primitive-inlining #f])
|
||||
|
|
4
s/cp0.ss
4
s/cp0.ss
|
@ -794,6 +794,10 @@
|
|||
(record-equal? e1 e2 (if (eq? ctxt 'test) 'test 'value))
|
||||
(simple? e1))
|
||||
e1]
|
||||
[(and (cp0-constant? (lambda (x) (eq? x #f)) e3)
|
||||
(cp0-constant? (lambda (x) (eq? x #t)) e2)
|
||||
(or (boolean-valued? e1) (eq? ctxt 'test)))
|
||||
(make-nontail ctxt e1)]
|
||||
[(nanopass-case (Lsrc Expr) (result-exp e1)
|
||||
[(if ,e11 ,[result-exp : e12 -> re12] ,[result-exp : e13 -> re13])
|
||||
(if (and (cp0-constant? re12) (cp0-constant? re13))
|
||||
|
|
Loading…
Reference in New Issue
Block a user