optimizer: enable movement of constants that shouldn't be duplicated
Closes PR 14531
This commit is contained in:
parent
d2d9b2cce3
commit
dad9d001e1
|
@ -1565,6 +1565,11 @@
|
|||
(check '(case-lambda [() 1] [(x y) x]) '(0 2) '(1 3))
|
||||
(check '(lambda (x [y #f]) y) '(1 2) '(0 3)))
|
||||
|
||||
(test-comp '(lambda ()
|
||||
(let ([l '(1 2)])
|
||||
(car l)))
|
||||
'(lambda () 1))
|
||||
|
||||
(let ([test-dropped
|
||||
(lambda (cons-name . args)
|
||||
(test-comp `(let ([x 5])
|
||||
|
@ -1666,7 +1671,8 @@
|
|||
(test-move '(cons 1 2 3) #f)
|
||||
(test-move '(mcons 1 2 3) #f)
|
||||
(test-move '(box 1 2) #f)
|
||||
(test-move '(box-immutable 1 2) #f)))
|
||||
(test-move '(box-immutable 1 2) #f)
|
||||
(test-move '(quote (1 2)) #t)))
|
||||
|
||||
;; Check move in to `else` branch where `then`
|
||||
;; branch might capture a continuation
|
||||
|
|
|
@ -911,7 +911,7 @@ Scheme_Object *scheme_make_struct_proc_shape(intptr_t k)
|
|||
}
|
||||
|
||||
static int single_valued_noncm_expression(Scheme_Object *expr, int fuel)
|
||||
/* Non-omittable but single-valued expresions that are not sensitive
|
||||
/* Non-omittable/non-copyable but single-valued expresions that are not sensitive
|
||||
to being in tail position. */
|
||||
{
|
||||
Scheme_Object *rator = NULL;
|
||||
|
@ -938,6 +938,10 @@ static int single_valued_noncm_expression(Scheme_Object *expr, int fuel)
|
|||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (SCHEME_TYPE(expr) > _scheme_compiled_values_types_)
|
||||
return 1;
|
||||
break;
|
||||
}
|
||||
|
||||
if (rator && SCHEME_PRIMP(rator)) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user