adjust inliner to avoid infinite inline
Fixes optimization for an expression like (define (f x) (lambda (y) (letrec ([recursion (f x)]) (+ x y)))) by adjusting the inlining hueristic to support less inlining on a second pass of `letrec` right-hand sides. Closes #3027
This commit is contained in:
parent
e0d4ede953
commit
fa6e7101df
|
@ -6583,4 +6583,12 @@
|
|||
|
||||
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(module regression-test-to-make-sure-inlining-does-not-go-crazy racket/base
|
||||
(define (f x)
|
||||
(lambda (y)
|
||||
(letrec ([recursion (f x)])
|
||||
(+ x y)))))
|
||||
|
||||
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(report-errs)
|
||||
|
|
|
@ -8096,6 +8096,8 @@ static Scheme_Object *optimize_lets(Scheme_Object *form, Optimize_Info *info, in
|
|||
avoid the possibility of N^2 behavior. */
|
||||
if (!OPT_DISCOURAGE_EARLY_INLINE)
|
||||
rhs_info->letrec_not_twice++;
|
||||
inline_fuel = rhs_info->inline_fuel;
|
||||
rhs_info->inline_fuel >>= 1;
|
||||
use_psize = rhs_info->use_psize;
|
||||
rhs_info->use_psize = info->use_psize;
|
||||
|
||||
|
@ -8111,6 +8113,7 @@ static Scheme_Object *optimize_lets(Scheme_Object *form, Optimize_Info *info, in
|
|||
|
||||
if (!OPT_DISCOURAGE_EARLY_INLINE)
|
||||
--rhs_info->letrec_not_twice;
|
||||
rhs_info->inline_fuel = inline_fuel;
|
||||
rhs_info->use_psize = use_psize;
|
||||
|
||||
irlv->value = value;
|
||||
|
|
Loading…
Reference in New Issue
Block a user