[PUSHED 4/8] Adjust op_with_boolean_value_range_p for irange API.

Aldy Hernandez aldyh@redhat.com
Tue Aug 4 06:34:43 GMT 2020


It seems to me that we should also check for [0,0] and [1,1] in the
range, but I am leaving things as is to avoid functional changes.

gcc/ChangeLog:

	* vr-values.c (simplify_using_ranges::op_with_boolean_value_range_p): Adjust
	for irange API.
---
 gcc/vr-values.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/gcc/vr-values.c b/gcc/vr-values.c
index 609375c072e..1190fa96453 100644
--- a/gcc/vr-values.c
+++ b/gcc/vr-values.c
@@ -448,10 +448,11 @@ simplify_using_ranges::op_with_boolean_value_range_p (tree op)
   if (TREE_CODE (op) != SSA_NAME)
     return false;
 
+  /* ?? Errr, this should probably check for [0,0] and [1,1] as well
+     as [0,1].  */
   const value_range *vr = get_value_range (op);
-  return (vr->kind () == VR_RANGE
-	  && integer_zerop (vr->min ())
-	  && integer_onep (vr->max ()));
+  return *vr == value_range (build_zero_cst (TREE_TYPE (op)),
+			     build_one_cst (TREE_TYPE (op)));
 }
 
 /* Extract value range information for VAR when (OP COND_CODE LIMIT) is
-- 
2.26.2



More information about the Gcc-patches mailing list