diff --git a/collects/tests/typed-racket/optimizer/missed-optimizations/fixnum.rkt b/collects/tests/typed-racket/optimizer/missed-optimizations/fixnum.rkt index 2625d3f3..b0bf6a91 100644 --- a/collects/tests/typed-racket/optimizer/missed-optimizations/fixnum.rkt +++ b/collects/tests/typed-racket/optimizer/missed-optimizations/fixnum.rkt @@ -3,8 +3,6 @@ TR opt: fixnum.rkt 35:10 (* x y) -- fixnum bounded expr TR missed opt: fixnum.rkt 38:0 (+ (ann z Fixnum) 234) -- out of fixnum range TR missed opt: fixnum.rkt 39:0 (* (ann x Index) (ann y Index)) -- out of fixnum range -TR missed opt: fixnum.rkt 40:0 (fx* (ann x Index) (ann y Index)) -- out of fixnum range -TR missed opt: fixnum.rkt 41:0 (abs (ann -3 Fixnum)) -- out of fixnum range TR opt: fixnum.rkt 42:3 (+ 300 301) -- fixnum bounded expr TR opt: fixnum.rkt 42:15 (+ 301 302) -- fixnum bounded expr TR missed opt: fixnum.rkt 42:0 (+ (+ 300 301) (+ 301 302)) -- out of fixnum range @@ -14,10 +12,8 @@ TR opt: fixnum.rkt 42:3 (+ 300 301) -- fixnum bounded expr TR opt: fixnum.rkt 42:15 (+ 301 302) -- fixnum bounded expr TR opt: fixnum.rkt 43:5 (+ 300 301) -- fixnum bounded expr TR opt: fixnum.rkt 43:17 (+ 301 302) -- fixnum bounded expr -TR missed opt: fixnum.rkt 43:0 (fx+ (+ 300 301) (+ 301 302)) -- out of fixnum range TR opt: fixnum.rkt 43:5 (+ 300 301) -- fixnum bounded expr TR opt: fixnum.rkt 43:17 (+ 301 302) -- fixnum bounded expr -TR missed opt: fixnum.rkt 44:0 (fxquotient -4 -5) -- out of fixnum range 468 234 234 @@ -30,6 +26,10 @@ TR missed opt: fixnum.rkt 44:0 (fxquotient -4 -5) -- out of fixnum range (require racket/fixnum) + + + + (define x 3) (define y 78) (define z (* x y)) ; this should be optimized @@ -37,8 +37,8 @@ TR missed opt: fixnum.rkt 44:0 (fxquotient -4 -5) -- out of fixnum range ;; this should not, (+ Fixnum Byte), but it may look like it should (+ (ann z Fixnum) 234) (* (ann x Index) (ann y Index)) -(fx* (ann x Index) (ann y Index)) +(fx* (ann x Index) (ann y Index)) ; not reported, by design (abs (ann -3 Fixnum)) (+ (+ 300 301) (+ 301 302)) -(fx+ (+ 300 301) (+ 301 302)) -(fxquotient -4 -5) +(fx+ (+ 300 301) (+ 301 302)) ; not reported, by design +(fxquotient -4 -5) ; not reported, by design diff --git a/collects/tests/typed-racket/optimizer/missed-optimizations/precision-loss.rkt b/collects/tests/typed-racket/optimizer/missed-optimizations/precision-loss.rkt index c39ee302..dd17daf9 100644 --- a/collects/tests/typed-racket/optimizer/missed-optimizations/precision-loss.rkt +++ b/collects/tests/typed-racket/optimizer/missed-optimizations/precision-loss.rkt @@ -5,7 +5,7 @@ TR opt: precision-loss.rkt 36:0 (+ (* 3/4 2/3) 2.0) -- binary float TR opt: precision-loss.rkt 38:0 (+ 3/4 2.0) -- binary float TR missed opt: precision-loss.rkt 40:0 (+ (- 3/4) 2.0) -- exact ops inside float expr -- caused by: 40:3 (- 3/4) TR opt: precision-loss.rkt 40:0 (+ (- 3/4) 2.0) -- binary float -TR opt: precision-loss.rkt 42:0 (+ (vector-ref (quote #(2/3 1/2 3/4)) (assert (+ 1/4 3/4) exact-integer?)) 2.0) -- binary float +TR missed opt: precision-loss.rkt 42:0 (+ (vector-ref (quote #(2/3 1/2 3/4)) (assert (+ 1/4 3/4) exact-integer?)) 2.0) -- all args float-arg-expr, result not Float -- caused by: 42:3 (vector-ref (quote #(2/3 1/2 3/4)) (assert (+ 1/4 3/4) exact-integer?)) TR missed opt: precision-loss.rkt 48:8 (* 3/4 2/3) -- all args float-arg-expr, result not Float -- caused by: 48:11 3/4, 48:15 2/3 TR opt: precision-loss.rkt 49:3 (car (list (* 2.0 (ann (* 3/4 2/3) Real)))) -- pair TR missed opt: precision-loss.rkt 49:26 (* 3/4 2/3) -- all args float-arg-expr, result not Float -- caused by: 49:29 3/4, 49:33 2/3 diff --git a/collects/tests/typed-racket/optimizer/tests/fixnum-bounded-expr.rkt b/collects/tests/typed-racket/optimizer/tests/fixnum-bounded-expr.rkt index 77cc604a..58081530 100644 --- a/collects/tests/typed-racket/optimizer/tests/fixnum-bounded-expr.rkt +++ b/collects/tests/typed-racket/optimizer/tests/fixnum-bounded-expr.rkt @@ -7,7 +7,6 @@ TR opt: fixnum-bounded-expr.rkt 82:2 (+ x y) -- fixnum bounded expr TR opt: fixnum-bounded-expr.rkt 85:2 (+ x y) -- fixnum bounded expr TR missed opt: fixnum-bounded-expr.rkt 88:2 (+ x y) -- out of fixnum range TR opt: fixnum-bounded-expr.rkt 90:0 (abs 45) -- fixnum fxabs -TR missed opt: fixnum-bounded-expr.rkt 91:0 (abs (ann -3 Fixnum)) -- out of fixnum range TR opt: fixnum-bounded-expr.rkt 93:0 (fx+ 5 2) -- fixnum fx+ TR opt: fixnum-bounded-expr.rkt 94:5 (+ 34 231) -- fixnum bounded expr TR opt: fixnum-bounded-expr.rkt 94:16 (* 24 25) -- fixnum bounded expr @@ -20,19 +19,14 @@ TR opt: fixnum-bounded-expr.rkt 96:8 (+ (+ 34 231) 23) -- fixnum bounded expr TR opt: fixnum-bounded-expr.rkt 96:0 (fx+ -4 (+ (+ 34 231) 23)) -- fixnum fx+ TR opt: fixnum-bounded-expr.rkt 97:5 (+ 300 301) -- fixnum bounded expr TR opt: fixnum-bounded-expr.rkt 97:17 (+ 301 302) -- fixnum bounded expr -TR missed opt: fixnum-bounded-expr.rkt 97:0 (fx+ (+ 300 301) (+ 301 302)) -- out of fixnum range TR opt: fixnum-bounded-expr.rkt 97:5 (+ 300 301) -- fixnum bounded expr TR opt: fixnum-bounded-expr.rkt 97:17 (+ 301 302) -- fixnum bounded expr TR opt: fixnum-bounded-expr.rkt 99:5 (+ 300 301) -- fixnum bounded expr TR opt: fixnum-bounded-expr.rkt 99:17 (+ 301 302) -- fixnum bounded expr TR opt: fixnum-bounded-expr.rkt 99:0 (fx- (+ 300 301) (+ 301 302)) -- fixnum fx- -TR missed opt: fixnum-bounded-expr.rkt 100:0 (fx- (ann 3 Fixnum) (ann 4 Fixnum)) -- out of fixnum range TR opt: fixnum-bounded-expr.rkt 102:0 (fx* 4 5) -- fixnum fx* -TR missed opt: fixnum-bounded-expr.rkt 103:0 (fx* 300 300) -- out of fixnum range TR opt: fixnum-bounded-expr.rkt 105:0 (fxquotient (ann 34 Nonnegative-Fixnum) (ann -4 Fixnum)) -- fixnum fxquotient -TR missed opt: fixnum-bounded-expr.rkt 106:0 (fxquotient -4 -5) -- out of fixnum range TR opt: fixnum-bounded-expr.rkt 108:0 (fxabs (ann 64235 Nonnegative-Fixnum)) -- fixnum fxabs -TR missed opt: fixnum-bounded-expr.rkt 109:0 (fxabs -4) -- out of fixnum range 28 89525 28 @@ -64,6 +58,12 @@ TR missed opt: fixnum-bounded-expr.rkt 109:0 (fxabs -4) -- out of fixnum range (require racket/fixnum) + + + + + + (: f : Index Byte -> Nonnegative-Fixnum) (define (f x y) (+ x (sqr y))) diff --git a/collects/tests/typed-racket/optimizer/tests/float-promotion.rkt b/collects/tests/typed-racket/optimizer/tests/float-promotion.rkt index 0bc63027..fee7c769 100644 --- a/collects/tests/typed-racket/optimizer/tests/float-promotion.rkt +++ b/collects/tests/typed-racket/optimizer/tests/float-promotion.rkt @@ -1,15 +1,15 @@ #; ( -TR opt: float-promotion.rkt 14:3 (modulo 1 1) -- binary nonzero fixnum -TR opt: float-promotion.rkt 14:3 (modulo 1 1) -- binary nonzero fixnum -TR opt: float-promotion.rkt 14:0 (+ (modulo 1 1) 2.0) -- binary float +TR opt: float-promotion.rkt 14:11 (modulo 1 2) -- binary nonzero fixnum +TR opt: float-promotion.rkt 14:11 (modulo 1 2) -- binary nonzero fixnum +TR opt: float-promotion.rkt 14:0 (+ (assert (modulo 1 2) exact-positive-integer?) 2.0) -- binary float TR opt: float-promotion.rkt 15:0 (+ (expt 100 100) 2.0) -- binary float -2.0 +3.0 1e+200 ) #lang typed/scheme #:optimize -(+ (modulo 1 1) 2.0) +(+ (assert (modulo 1 2) exact-positive-integer?) 2.0) (+ (expt 100 100) 2.0) diff --git a/collects/tests/typed-racket/optimizer/tests/float-real.rkt b/collects/tests/typed-racket/optimizer/tests/float-real.rkt index 417c216c..b7de71ba 100644 --- a/collects/tests/typed-racket/optimizer/tests/float-real.rkt +++ b/collects/tests/typed-racket/optimizer/tests/float-real.rkt @@ -1,8 +1,8 @@ #; ( -TR opt: float-real.rkt 18:0 (+ 2.3 (ann 3 Real)) -- binary float -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 opt: float-real.rkt 19:0 (+ 2.3 (* (ann 2 Integer) 3.2)) -- binary float +TR opt: float-real.rkt 18:0 (+ 2.3 (ann 3 Positive-Real)) -- binary float +TR missed opt: float-real.rkt 19:15 (* (ann 2 Integer) 3.2) -- all args float-arg-expr, result not Float -- caused by: 19:23 2 +TR opt: float-real.rkt 19:0 (+ 2.3 (assert (* (ann 2 Integer) 3.2) positive?)) -- binary float TR missed opt: float-real.rkt 20:7 (* (ann 2 Integer) 3.1) -- all args float-arg-expr, result not Float -- caused by: 20:15 2 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:7 (* (ann 2 Integer) 3.1) TR missed opt: float-real.rkt 20:7 (* (ann 2 Integer) 3.1) -- all args float-arg-expr, result not Float -- caused by: 20:15 2 @@ -15,6 +15,6 @@ TR missed opt: float-real.rkt 20:7 (* (ann 2 Integer) 3.1) -- all args float-arg #lang typed/racket ;; reals within float expressions should be coerced when it's safe to do so -(+ 2.3 (ann 3 Real)) ; safe -(+ 2.3 (* (ann 2 Integer) 3.2)) ; inner = unsafe, outer = safe +(+ 2.3 (ann 3 Positive-Real)) ; safe +(+ 2.3 (assert (* (ann 2 Integer) 3.2) positive?)) ; inner = unsafe, outer = unsafe (* 2.3 (* (ann 2 Integer) 3.1)) ; all unsafe diff --git a/collects/tests/typed-racket/optimizer/tests/vector-bounds-check.rkt b/collects/tests/typed-racket/optimizer/tests/vector-bounds-check.rkt index e43b3fe3..d87044d1 100644 --- a/collects/tests/typed-racket/optimizer/tests/vector-bounds-check.rkt +++ b/collects/tests/typed-racket/optimizer/tests/vector-bounds-check.rkt @@ -1,5 +1,7 @@ #; ( +TR opt: vector-bounds-check.rkt 25:0 (vector-ref (make-my-vector) 0) -- vector partial bounds checking elimination +TR opt: vector-bounds-check.rkt 26:0 (flvector-ref (make-my-flvector) 0) -- flvector partial bounds checking elimination 1.0 1.0 )