aboutsummaryrefslogtreecommitdiffstats
path: root/lib/hipe/cerl
diff options
context:
space:
mode:
authorMagnus Lång <[email protected]>2017-03-04 14:52:46 +0100
committerMagnus Lång <[email protected]>2017-03-27 13:18:51 +0200
commit7eb0f13659f045dad0db27e4c8e1c6588d6eb044 (patch)
tree4b90189cf202517be5734c220e3a2c3c63279f46 /lib/hipe/cerl
parentbe2b0e6e5b4786cb6f7d56cdcdc05339aa214406 (diff)
downloadotp-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/cerl')
-rw-r--r--lib/hipe/cerl/erl_bif_types.erl5
1 files changed, 1 insertions, 4 deletions
diff --git a/lib/hipe/cerl/erl_bif_types.erl b/lib/hipe/cerl/erl_bif_types.erl
index 8c96e60229..9321750d44 100644
--- a/lib/hipe/cerl/erl_bif_types.erl
+++ b/lib/hipe/cerl/erl_bif_types.erl
@@ -2029,17 +2029,14 @@ arith_rem(Min1, Max1, Min2, Max2) ->
Min1_geq_zero = infinity_geq(Min1, 0),
Max1_leq_zero = infinity_geq(0, Max1),
Max_range2 = infinity_max([infinity_abs(Min2), infinity_abs(Max2)]),
- Max_range2_leq_zero = infinity_geq(0, Max_range2),
- New_min =
+ New_min =
if Min1_geq_zero -> 0;
Max_range2 =:= 0 -> 0;
- Max_range2_leq_zero -> infinity_add(Max_range2, 1);
true -> infinity_add(infinity_inv(Max_range2), 1)
end,
New_max =
if Max1_leq_zero -> 0;
Max_range2 =:= 0 -> 0;
- Max_range2_leq_zero -> infinity_add(infinity_inv(Max_range2), -1);
true -> infinity_add(Max_range2, -1)
end,
{New_min, New_max}.