Fix unsound unary fixnum subtraction optimization.
Closes PR13826.
(cherry picked from commit 93d4a5d426
)
This commit is contained in:
parent
4e360f8bc3
commit
fe96ba1516
|
@ -1,10 +1,15 @@
|
||||||
#;
|
#;
|
||||||
(
|
(
|
||||||
TR opt: unary-fixnum.rkt 10:0 (bitwise-not 4) -- unary fixnum
|
TR opt: unary-fixnum.rkt 13:0 (bitwise-not 4) -- unary fixnum
|
||||||
|
TR opt: unary-fixnum.rkt 14:0 (- (ann 2 Nonnegative-Fixnum)) -- unary fixnum
|
||||||
-5
|
-5
|
||||||
|
-2
|
||||||
|
2
|
||||||
)
|
)
|
||||||
|
|
||||||
#lang typed/scheme
|
#lang typed/scheme
|
||||||
#:optimize
|
#:optimize
|
||||||
|
|
||||||
(bitwise-not 4)
|
(bitwise-not 4)
|
||||||
|
(- (ann 2 Nonnegative-Fixnum))
|
||||||
|
(- (ann -2 Negative-Fixnum)) ; can't optimize negatives
|
||||||
|
|
|
@ -131,6 +131,8 @@
|
||||||
#'(op.unsafe n1.opt n2.opt)))
|
#'(op.unsafe n1.opt n2.opt)))
|
||||||
|
|
||||||
(pattern (#%plain-app (~and op (~literal -)) f:fixnum-expr)
|
(pattern (#%plain-app (~and op (~literal -)) f:fixnum-expr)
|
||||||
|
;; Invalid for `(- <most-negative-fixnum>)'.
|
||||||
|
#:when (subtypeof? #'f -NonNegFixnum)
|
||||||
#:with opt
|
#:with opt
|
||||||
(begin (log-optimization "unary fixnum" fixnum-opt-msg this-syntax)
|
(begin (log-optimization "unary fixnum" fixnum-opt-msg this-syntax)
|
||||||
(add-disappeared-use #'op)
|
(add-disappeared-use #'op)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user