Refactor away an obsolete is_unsigned distinction in is_value_included_in

Message ID 87woisgxfr.fsf@ispras.ru
State New
Headers show
Series
  • Refactor away an obsolete is_unsigned distinction in is_value_included_in
Related show

Commit Message

Vladislav Ivanishin May 15, 2019, 4:21 a.m.
Hi!

This is just a clean-up.  During the course of past refactorings, the
then and else branches of `if (is_unsigned)` in is_value_included_in()
became semantically equivalent and almost textually identical.  This
patch removes the conditional altogether.

Regtested and bootstrapped with `BOOT_CFLAGS="-O
-Wno-error=maybe-uninitialized -Wuninitialized"` on x86_64-pc-linux-gnu.

OK for trunk?
-- 
Vlad

Comments

Richard Biener May 15, 2019, 11:06 a.m. | #1
On Wed, May 15, 2019 at 6:21 AM Vladislav Ivanishin <vlad@ispras.ru> wrote:
>

> Hi!

>

> This is just a clean-up.  During the course of past refactorings, the

> then and else branches of `if (is_unsigned)` in is_value_included_in()

> became semantically equivalent and almost textually identical.  This

> patch removes the conditional altogether.

>

> Regtested and bootstrapped with `BOOT_CFLAGS="-O

> -Wno-error=maybe-uninitialized -Wuninitialized"` on x86_64-pc-linux-gnu.

>

> OK for trunk?


OK.

Richard.

>

> --

> Vlad

Patch

gcc/Changelog:

        * tree-ssa-uninit.c (is_value_included_in): remove is_unsigned and merge
        semantically equivalent branches (left over after prior refactorings).
---
 gcc/tree-ssa-uninit.c | 31 ++++++-------------------------
 1 file changed, 6 insertions(+), 25 deletions(-)

diff --git a/gcc/tree-ssa-uninit.c b/gcc/tree-ssa-uninit.c
index 831587854c6..7362e374dea 100644
--- a/gcc/tree-ssa-uninit.c
+++ b/gcc/tree-ssa-uninit.c
@@ -1017,45 +1017,26 @@  static bool
 is_value_included_in (tree val, tree boundary, enum tree_code cmpc)
 {
   bool inverted = false;
-  bool is_unsigned;
   bool result;
 
   /* Only handle integer constant here.  */
   if (TREE_CODE (val) != INTEGER_CST || TREE_CODE (boundary) != INTEGER_CST)
     return true;
 
-  is_unsigned = TYPE_UNSIGNED (TREE_TYPE (val));
-
   if (cmpc == GE_EXPR || cmpc == GT_EXPR || cmpc == NE_EXPR)
     {
       cmpc = invert_tree_comparison (cmpc, false);
       inverted = true;
     }
 
-  if (is_unsigned)
-    {
-      if (cmpc == EQ_EXPR)
-	result = tree_int_cst_equal (val, boundary);
-      else if (cmpc == LT_EXPR)
-	result = tree_int_cst_lt (val, boundary);
-      else
-	{
-	  gcc_assert (cmpc == LE_EXPR);
-	  result = tree_int_cst_le (val, boundary);
-	}
-    }
+  if (cmpc == EQ_EXPR)
+    result = tree_int_cst_equal (val, boundary);
+  else if (cmpc == LT_EXPR)
+    result = tree_int_cst_lt (val, boundary);
   else
     {
-      if (cmpc == EQ_EXPR)
-	result = tree_int_cst_equal (val, boundary);
-      else if (cmpc == LT_EXPR)
-	result = tree_int_cst_lt (val, boundary);
-      else
-	{
-	  gcc_assert (cmpc == LE_EXPR);
-	  result = (tree_int_cst_equal (val, boundary)
-		    || tree_int_cst_lt (val, boundary));
-	}
+      gcc_assert (cmpc == LE_EXPR);
+      result = tree_int_cst_le (val, boundary);
     }
 
   if (inverted)
-- 
2.21.0