diff options
author | Magnus Lång <[email protected]> | 2017-03-04 14:52:46 +0100 |
---|---|---|
committer | Magnus Lång <[email protected]> | 2017-03-27 13:18:51 +0200 |
commit | 7eb0f13659f045dad0db27e4c8e1c6588d6eb044 (patch) | |
tree | 4b90189cf202517be5734c220e3a2c3c63279f46 /lib/hipe/icode/hipe_icode_range.erl | |
parent | be2b0e6e5b4786cb6f7d56cdcdc05339aa214406 (diff) | |
download | otp-7eb0f13659f045dad0db27e4c8e1c6588d6eb044.tar.gz otp-7eb0f13659f045dad0db27e4c8e1c6588d6eb044.tar.bz2 otp-7eb0f13659f045dad0db27e4c8e1c6588d6eb044.zip |
hipe: Fix range analysis of 'rem' operator
erl_bif_types contains a fixed and improved copy-paste (obvious from the
dead Max_range2_leq_zero if branches) of hipe_icode_range:range_rem/2.
For now, delete the dead code and propagate back fixes and improvements
to hipe_icode_range.
Diffstat (limited to 'lib/hipe/icode/hipe_icode_range.erl')
-rw-r--r-- | lib/hipe/icode/hipe_icode_range.erl | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/hipe/icode/hipe_icode_range.erl b/lib/hipe/icode/hipe_icode_range.erl index b884132327..9aed40bd6d 100644 --- a/lib/hipe/icode/hipe_icode_range.erl +++ b/lib/hipe/icode/hipe_icode_range.erl @@ -1306,16 +1306,15 @@ range_rem(Range1, Range2) -> Min1_geq_zero = inf_geq(Min1, 0), Max1_leq_zero = inf_geq(0, Max1), Max_range2 = inf_max([inf_abs(Min2), inf_abs(Max2)]), - Max_range2_leq_zero = inf_geq(0, Max_range2), New_min = if Min1_geq_zero -> 0; - Max_range2_leq_zero -> Max_range2; - true -> inf_inv(Max_range2) + Max_range2 =:= 0 -> 0; + true -> inf_add(inf_inv(Max_range2), 1) end, New_max = if Max1_leq_zero -> 0; - Max_range2_leq_zero -> inf_inv(Max_range2); - true -> Max_range2 + Max_range2 =:= 0 -> 0; + true -> inf_add(Max_range2, -1) end, range_init({New_min, New_max}, false). |