Change the structure of the "extra precision" missed optimizations.

Avoids reports that are almost duplicates.

original commit: db9d51fef7505776a7250446496c1784043472e1
This commit is contained in:
Vincent St-Amour 2011-07-14 18:35:35 -04:00
parent 718e488786
commit 02a4010880
2 changed files with 27 additions and 24 deletions

View File

@ -1,14 +1,13 @@
#;
(
TR missed opt: nested-same-kind.rkt 25:0 (* 2.0 (* 3.0 (ann 4 Integer))) -- exact ops inside float expr -- caused by: 25:7 (* 3.0 (ann 4 Integer))
TR missed opt: nested-same-kind.rkt 25:0 (* 2.0 (* 3.0 (ann 4 Integer))) -- all args float-arg-expr, result not Float -- caused by: 25:19 4 (2 times)
TR missed opt: nested-same-kind.rkt 26:0 (* 1.0 (* 2.0 (* 3.0 (ann 4 Integer)))) -- exact ops inside float expr -- caused by: 26:14 (* 3.0 (ann 4 Integer)) (2 times)
TR missed opt: nested-same-kind.rkt 26:0 (* 1.0 (* 2.0 (* 3.0 (ann 4 Integer)))) -- all args float-arg-expr, result not Float -- caused by: 26:26 4 (3 times)
TR missed opt: nested-same-kind.rkt 27:0 (* 2.0 (* 3.0 (ann 4 Integer) (ann 5 Integer))) -- exact ops inside float expr -- caused by: 27:7 (* 3.0 (ann 4 Integer) (ann 5 Integer))
TR missed opt: nested-same-kind.rkt 27:0 (* 2.0 (* 3.0 (ann 4 Integer) (ann 5 Integer))) -- all args float-arg-expr, result not Float -- caused by: 27:19 4, 27:35 5 (2 times)
TR missed opt: nested-same-kind.rkt 28:0 (* (* 3.0 (ann 4 Integer)) (* 3.0 (ann 4 Integer))) -- exact ops inside float expr -- caused by: 28:27 (* 3.0 (ann 4 Integer))
TR missed opt: nested-same-kind.rkt 28:0 (* (* 3.0 (ann 4 Integer)) (* 3.0 (ann 4 Integer))) -- exact ops inside float expr -- caused by: 28:3 (* 3.0 (ann 4 Integer))
TR missed opt: nested-same-kind.rkt 28:0 (* (* 3.0 (ann 4 Integer)) (* 3.0 (ann 4 Integer))) -- all args float-arg-expr, result not Float -- caused by: 28:15 4, 28:39 4 (3 times)
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)
24.0
24.0
120.0

View File

@ -121,21 +121,25 @@
;; use cases for computing exact intermediate results, then converting them to
;; floats at the end.
(when (or safe-to-opt? missed-optimization?)
(for ([subexpr (in-list (syntax->list #'(f1 f2 fs ...)))]
#:when (or (in-real-layer? subexpr)
(in-rational-layer? subexpr)))
(syntax-parse subexpr
;; Only warn about subexpressions that actually perform exact arithmetic.
;; There's not much point in warning about literals/variables that will
;; be coerced anyway, or about things like:
;; (vector-ref vector-of-rationals x)
;; which don't perform arithmetic despite returning numbers.
[e:arith-expr
(log-missed-optimization
"exact ops inside float expr"
"This expression has a Float type, but the highlighted subexpression(s) use exact arithmetic. The extra precision of the exact arithmetic will be lost. Using Float types in these subexpression(s) may result in performance gains without significant precision loss."
this-syntax subexpr)]
[_ #f])))
(define extra-precision-subexprs
(filter
values
(for/list ([subexpr (in-list (syntax->list #'(f1 f2 fs ...)))]
#:when (or (in-real-layer? subexpr)
(in-rational-layer? subexpr)))
(syntax-parse subexpr
;; Only warn about subexpressions that actually perform exact arithmetic.
;; There's not much point in warning about literals/variables that will
;; 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]
[_ #f]))))
(when (not (null? extra-precision-subexprs))
(log-missed-optimization
"exact ops inside float expr"
"This expression has a Float type, but the highlighted subexpression(s) use exact arithmetic. The extra precision of the exact arithmetic will be lost. Using Float types in these subexpression(s) may result in performance gains without significant precision loss."
this-syntax extra-precision-subexprs)))
safe-to-opt?)
#:with opt
(begin (log-optimization "binary float" float-opt-msg this-syntax)