optimizer: fix coordinate shift when a letrec is split

The combination of splitting a `letrec` and optimizing
the resulting `(let ([x <proc>]) x)` to just `<proc>`
used a bad coordinate shift, which made property testing
incorrect, etc.

For reasons that are not clear, the new expander triggered
the problem through an existing test.
This commit is contained in:
Matthew Flatt 2015-07-16 18:12:46 -06:00
parent e65beb2636
commit aaee824f68

View File

@ -6372,7 +6372,7 @@ scheme_optimize_lets(Scheme_Object *form, Optimize_Info *info, int for_inline, i
&& (((Scheme_Local *)clv->body)->position == 0)) {
if (worth_lifting(clv->value)) {
value = clv->value;
extract_depth = 1;
extract_depth = 1 + split_shift;
}
}
}
@ -7500,7 +7500,7 @@ Scheme_Object *scheme_optimize_expr(Scheme_Object *expr, Optimize_Info *info, in
delta = optimize_info_get_shift(info, pos);
if (!optimize_is_mutated(info, pos + delta)) {
if (!is_mutated) {
Scheme_Object *pred;
pred = optimize_get_predicate(pos + delta, info);