optimizer: allow to move once_used to test position

This commit is contained in:
Gustavo Massaccesi 2014-07-06 16:27:24 -03:00 committed by Matthew Flatt
parent 82ffd40592
commit 25c05d66b6
2 changed files with 6 additions and 1 deletions

View File

@ -1389,6 +1389,10 @@
(a1)
(a2))))
(test-comp '(lambda (x) (let ([r (something)])
(if r #t (something-else))))
'(lambda (x) (if (something) #t (something-else))))
(test-comp '(if (let ([z (random)]) null) 1 2)
'(if (let ([z (random)]) #t) 1 2))

View File

@ -6701,7 +6701,8 @@ Scheme_Object *scheme_optimize_expr(Scheme_Object *expr, Optimize_Info *info, in
if (SAME_TYPE(SCHEME_TYPE(val), scheme_once_used_type)) {
Scheme_Once_Used *o = (Scheme_Once_Used *)val;
if (((o->vclock == info->vclock)
&& single_valued_noncm_expression(o->expr, 5))
&& ((context & OPT_CONTEXT_BOOLEAN)
|| single_valued_noncm_expression(o->expr, 5)))
|| movable_expression(o->expr, info, o->delta, o->cross_lambda,
o->kclock != info->kclock,
0, 5)) {