optimizer: fix inference bug
The optimizer's inference that could incorrectly that that a conditional produced a flonum (when it actually produced a fixnum or a fixnum in one branch and flonum in the other).
This commit is contained in:
parent
948a709b47
commit
2eef2ce409
|
@ -3711,6 +3711,16 @@
|
|||
|
||||
(test 'c dynamic-require ''check-jit-registers-shortcut 'result)
|
||||
|
||||
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Check (non-)inference of flonums with `if` branches:
|
||||
|
||||
(let ()
|
||||
(define f (lambda (x)
|
||||
(let ([v (if x 1 2.0)])
|
||||
(fl+ v v))))
|
||||
(set! f f)
|
||||
(err/rt-test (f #t)))
|
||||
|
||||
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(report-errs)
|
||||
|
|
|
@ -2021,8 +2021,14 @@ static int expr_produces_local_type(Scheme_Object *expr, int fuel)
|
|||
case scheme_branch_type:
|
||||
{
|
||||
Scheme_Branch_Rec *b = (Scheme_Branch_Rec *)expr;
|
||||
return (expr_produces_local_type(b->tbranch, fuel / 2)
|
||||
&& expr_produces_local_type(b->fbranch, fuel / 2));
|
||||
int t1, t2;
|
||||
|
||||
t1 = expr_produces_local_type(b->tbranch, fuel / 2);
|
||||
if (t1) {
|
||||
t2 = expr_produces_local_type(b->fbranch, fuel / 2);
|
||||
return ((t1 == t2) ? t1 : 0);
|
||||
} else
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
case scheme_sequence_type:
|
||||
|
|
Loading…
Reference in New Issue
Block a user