From 6a7a7f92bdae0e62170d4a556c2b007655960bf3 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Tue, 28 Nov 2017 08:15:03 +0000 Subject: [PATCH] re PR target/83158 (gcc.target/i386/pr78057.c fail) 2017-11-28 Richard Biener PR tree-optimization/83158 * tree-vrp.c (intersect_ranges): Prefer ~[0, 0] in a few more cases. From-SVN: r255190 --- gcc/ChangeLog | 6 ++++++ gcc/tree-vrp.c | 9 ++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index fe6b562427e..7f5e6cb4573 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2017-11-28 Richard Biener + + PR tree-optimization/83158 + * tree-vrp.c (intersect_ranges): Prefer ~[0, 0] in a few more + cases. + 2017-11-28 Segher Boessenkool PR 81288/target diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c index 5f9baa3e7ff..1217f8259b7 100644 --- a/gcc/tree-vrp.c +++ b/gcc/tree-vrp.c @@ -6021,11 +6021,14 @@ intersect_ranges (enum value_range_type *vr0type, && vrp_val_is_max (vr1max)) ; /* Choose the anti-range if it is ~[0,0], that range is special - enough to special case when vr1's range is relatively wide. */ + enough to special case when vr1's range is relatively wide. + At least for types bigger than int - this covers pointers + and arguments to functions like ctz. */ else if (*vr0min == *vr0max && integer_zerop (*vr0min) - && (TYPE_PRECISION (TREE_TYPE (*vr0min)) - == TYPE_PRECISION (ptr_type_node)) + && ((TYPE_PRECISION (TREE_TYPE (*vr0min)) + >= TYPE_PRECISION (integer_type_node)) + || POINTER_TYPE_P (TREE_TYPE (*vr0min))) && TREE_CODE (vr1max) == INTEGER_CST && TREE_CODE (vr1min) == INTEGER_CST && (wi::clz (wi::to_wide (vr1max) - wi::to_wide (vr1min)) -- 2.30.2