Have Optimization Coach report unsound float division missed optimizations.
This commit is contained in:
parent
02989b23a1
commit
459c731bb9
|
@ -6,6 +6,7 @@ TR opt: pr13468.rkt 86:5 (- (ann 6.0+2.3i Float-Complex)) -- unboxed unary float
|
||||||
TR opt: pr13468.rkt 87:13 6.0+2.3i -- unboxed literal
|
TR opt: pr13468.rkt 87:13 6.0+2.3i -- unboxed literal
|
||||||
TR opt: pr13468.rkt 87:13 6.0+2.3i -- unboxed literal
|
TR opt: pr13468.rkt 87:13 6.0+2.3i -- unboxed literal
|
||||||
TR opt: pr13468.rkt 87:5 (/ (ann 6.0+2.3i Float-Complex)) -- unboxed unary float complex
|
TR opt: pr13468.rkt 87:5 (/ (ann 6.0+2.3i Float-Complex)) -- unboxed unary float complex
|
||||||
|
TR missed opt: pr13468.rkt 88:5 (/ (ann 0.0+0.0i Float-Complex) (ann 1 Number)) -- Float-Complex division, potential exact 0s on the rhss -- caused by: 88:42 1
|
||||||
TR missed opt: pr13468.rkt 91:5 (expt (ann -5.0 Flonum) (ann 2.0 Flonum)) -- unexpected complex type
|
TR missed opt: pr13468.rkt 91:5 (expt (ann -5.0 Flonum) (ann 2.0 Flonum)) -- unexpected complex type
|
||||||
TR opt: pr13468.rkt 112:21 0.0 -- float-arg-expr in complex ops
|
TR opt: pr13468.rkt 112:21 0.0 -- float-arg-expr in complex ops
|
||||||
TR opt: pr13468.rkt 112:5 (magnitude (ann 0.0 Flonum-Zero)) -- unboxed unary float complex
|
TR opt: pr13468.rkt 112:5 (magnitude (ann 0.0 Flonum-Zero)) -- unboxed unary float complex
|
||||||
|
@ -81,7 +82,6 @@ TR opt: pr13468.rkt 143:5 (real-part (ann 6.0 Flonum)) -- unboxed unary float co
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
;; Most bothersome missing cases:
|
;; Most bothersome missing cases:
|
||||||
(ann (- (ann 6.0+2.3i Float-Complex)) Float-Complex)
|
(ann (- (ann 6.0+2.3i Float-Complex)) Float-Complex)
|
||||||
(ann (/ (ann 6.0+2.3i Float-Complex)) Float-Complex)
|
(ann (/ (ann 6.0+2.3i Float-Complex)) Float-Complex)
|
||||||
|
|
|
@ -600,11 +600,26 @@
|
||||||
;; otherwise, optimization is unsound (we'd give a result where we're supposed to throw an error)
|
;; otherwise, optimization is unsound (we'd give a result where we're supposed to throw an error)
|
||||||
(pattern (#%plain-app (~literal /) e:expr ...)
|
(pattern (#%plain-app (~literal /) e:expr ...)
|
||||||
#:when (subtypeof? this-syntax -FloatComplex)
|
#:when (subtypeof? this-syntax -FloatComplex)
|
||||||
#:when (for/and ([c (syntax->list #'(e ...))])
|
#:when (let ([irritants
|
||||||
(match (type-of c)
|
(for/list ([c (syntax->list #'(e ...))]
|
||||||
[(tc-result1: t)
|
#:when (match (type-of c)
|
||||||
(not (subtype -Zero t))]
|
[(tc-result1: t)
|
||||||
[_ #f]))
|
(subtype -Zero t)]
|
||||||
|
[_ #t]))
|
||||||
|
c)])
|
||||||
|
(define safe-to-opt? (null? irritants))
|
||||||
|
;; result is Float-Complex, but unsafe to optimize, missed optimization
|
||||||
|
(unless safe-to-opt?
|
||||||
|
(log-missed-optimization
|
||||||
|
"Float-Complex division, potential exact 0s on the rhss"
|
||||||
|
(string-append
|
||||||
|
"This expression has a Float-Complex type, but cannot be safely unboxed. "
|
||||||
|
"The second (and later) arguments could potentially be exact 0."
|
||||||
|
(if (null? irritants)
|
||||||
|
""
|
||||||
|
"\nTo fix, change the highlighted expression(s) to have Float (or Float-Complex) type(s)."))
|
||||||
|
this-syntax irritants))
|
||||||
|
safe-to-opt?)
|
||||||
#:with exp*:unboxed-float-complex-opt-expr this-syntax
|
#:with exp*:unboxed-float-complex-opt-expr this-syntax
|
||||||
#:with real-binding #'exp*.real-binding
|
#:with real-binding #'exp*.real-binding
|
||||||
#:with imag-binding #'exp*.imag-binding
|
#:with imag-binding #'exp*.imag-binding
|
||||||
|
|
Loading…
Reference in New Issue
Block a user