diff --git a/collects/tests/typed-scheme/optimizer/missed-optimizations/nested-same-kind.rkt b/collects/tests/typed-scheme/optimizer/missed-optimizations/nested-same-kind.rkt index 1ef7320b..a048835f 100644 --- a/collects/tests/typed-scheme/optimizer/missed-optimizations/nested-same-kind.rkt +++ b/collects/tests/typed-scheme/optimizer/missed-optimizations/nested-same-kind.rkt @@ -1,13 +1,9 @@ #; ( -TR missed opt: nested-same-kind.rkt 24:0 (* 2.0 (* 3.0 (ann 4 Integer))) -- exact ops inside float expr -- caused by: 24:7 (* 3.0 (ann 4 Integer)) -TR missed opt: nested-same-kind.rkt 24:0 (* 2.0 (* 3.0 (ann 4 Integer))) -- all args float-arg-expr, result not Float -- caused by: 24:19 4 (2 times) -TR missed opt: nested-same-kind.rkt 25:0 (* 1.0 (* 2.0 (* 3.0 (ann 4 Integer)))) -- exact ops inside float expr -- caused by: 25:14 (* 3.0 (ann 4 Integer)) (2 times) -TR missed opt: nested-same-kind.rkt 25:0 (* 1.0 (* 2.0 (* 3.0 (ann 4 Integer)))) -- all args float-arg-expr, result not Float -- caused by: 25:26 4 (3 times) -TR missed opt: nested-same-kind.rkt 26:0 (* 2.0 (* 3.0 (ann 4 Integer) (ann 5 Integer))) -- exact ops inside float expr -- caused by: 26:7 (* 3.0 (ann 4 Integer) (ann 5 Integer)) -TR missed opt: nested-same-kind.rkt 26:0 (* 2.0 (* 3.0 (ann 4 Integer) (ann 5 Integer))) -- all args float-arg-expr, result not Float -- caused by: 26:19 4, 26:35 5 (2 times) -TR missed opt: nested-same-kind.rkt 27:0 (* (* 3.0 (ann 4 Integer)) (* 3.0 (ann 4 Integer))) -- exact ops inside float expr -- caused by: 27:3 (* 3.0 (ann 4 Integer)), 27:27 (* 3.0 (ann 4 Integer)) -TR missed opt: nested-same-kind.rkt 27:0 (* (* 3.0 (ann 4 Integer)) (* 3.0 (ann 4 Integer))) -- all args float-arg-expr, result not Float -- caused by: 27:15 4, 27:39 4 (3 times) +TR missed opt: nested-same-kind.rkt 20:0 (* 2.0 (* 3.0 (ann 4 Integer))) -- all args float-arg-expr, result not Float -- caused by: 20:19 4 (2 times) +TR missed opt: nested-same-kind.rkt 21:0 (* 1.0 (* 2.0 (* 3.0 (ann 4 Integer)))) -- all args float-arg-expr, result not Float -- caused by: 21:26 4 (3 times) +TR missed opt: nested-same-kind.rkt 22:0 (* 2.0 (* 3.0 (ann 4 Integer) (ann 5 Integer))) -- all args float-arg-expr, result not Float -- caused by: 22:19 4, 22:35 5 (2 times) +TR missed opt: nested-same-kind.rkt 23:0 (* (* 3.0 (ann 4 Integer)) (* 3.0 (ann 4 Integer))) -- all args float-arg-expr, result not Float -- caused by: 23:15 4, 23:39 4 (3 times) 24.0 24.0 120.0 diff --git a/collects/tests/typed-scheme/optimizer/tests/float-real.rkt b/collects/tests/typed-scheme/optimizer/tests/float-real.rkt index d2a42daa..74a0601e 100644 --- a/collects/tests/typed-scheme/optimizer/tests/float-real.rkt +++ b/collects/tests/typed-scheme/optimizer/tests/float-real.rkt @@ -1,11 +1,9 @@ #; ( -TR opt: float-real.rkt 18:0 (+ 2.3 (ann 3 Real)) -- binary float -TR opt: float-real.rkt 19:0 (+ 2.3 (* (ann 2 Integer) 3.2)) -- binary float -TR missed opt: float-real.rkt 19:0 (+ 2.3 (* (ann 2 Integer) 3.2)) -- exact ops inside float expr -- caused by: 19:7 (* (ann 2 Integer) 3.2) -TR missed opt: float-real.rkt 19:7 (* (ann 2 Integer) 3.2) -- all args float-arg-expr, result not Float -- caused by: 19:15 2 -TR missed opt: float-real.rkt 20:0 (* 2.3 (* (ann 2 Integer) 3.1)) -- exact ops inside float expr -- caused by: 20:7 (* (ann 2 Integer) 3.1) -TR missed opt: float-real.rkt 20:0 (* 2.3 (* (ann 2 Integer) 3.1)) -- all args float-arg-expr, result not Float -- caused by: 20:15 2 (2 times) +TR opt: float-real.rkt 16:0 (+ 2.3 (ann 3 Real)) -- binary float +TR opt: float-real.rkt 17:0 (+ 2.3 (* (ann 2 Integer) 3.2)) -- binary float +TR missed opt: float-real.rkt 17:7 (* (ann 2 Integer) 3.2) -- all args float-arg-expr, result not Float -- caused by: 17:15 2 +TR missed opt: float-real.rkt 18:0 (* 2.3 (* (ann 2 Integer) 3.1)) -- all args float-arg-expr, result not Float -- caused by: 18:15 2 (2 times) 5.3 8.7 14.26 diff --git a/collects/typed-scheme/optimizer/float.rkt b/collects/typed-scheme/optimizer/float.rkt index 8e0a52fc..fcdb6ccb 100644 --- a/collects/typed-scheme/optimizer/float.rkt +++ b/collects/typed-scheme/optimizer/float.rkt @@ -133,7 +133,13 @@ ;; be coerced anyway, or about things like: ;; (vector-ref vector-of-rationals x) ;; which don't perform arithmetic despite returning numbers. - [e:arith-expr #'e] + [(~and e:arith-expr (op args ...)) + ;; if a subexpression has any float args, it will be reported as a + ;; float-real mix missed opt, so this report would be redundant + + #:when (for/and ([s (in-list (syntax->list #'(args ...)))]) + (not (in-float-layer? s))) + #'e] [_ #f])))) (when (not (null? extra-precision-subexprs)) (log-missed-optimization