It's incredibly annoying that some of the BRS_TRUE cases come after
BRS_FALSE, if only because we're not consistent.  Having random
ordering increases the changes of thinkos when adapting the irange
code to floats.

gcc/ChangeLog:

        * range-op.cc (operator_equal::op1_range): Move BRS_TRUE case up.
        (operator_lt::op2_range): Same.
        (operator_le::op2_range): Same.
        (operator_gt::op2_range): Same.
        (operator_ge::op2_range): Same.
---
 gcc/range-op.cc | 42 +++++++++++++++++++++---------------------
 1 file changed, 21 insertions(+), 21 deletions(-)

diff --git a/gcc/range-op.cc b/gcc/range-op.cc
index df0735cb42a..4d5a033dfa5 100644
--- a/gcc/range-op.cc
+++ b/gcc/range-op.cc
@@ -531,6 +531,11 @@ operator_equal::op1_range (irange &r, tree type,
 {
   switch (get_bool_state (r, lhs, type))
     {
+    case BRS_TRUE:
+      // If it's true, the result is the same as OP2.
+      r = op2;
+      break;
+
     case BRS_FALSE:
       // If the result is false, the only time we know anything is
       // if OP2 is a constant.
@@ -543,11 +548,6 @@ operator_equal::op1_range (irange &r, tree type,
        r.set_varying (type);
       break;
 
-    case BRS_TRUE:
-      // If it's true, the result is the same as OP2.
-      r = op2;
-      break;
-
     default:
       break;
     }
@@ -841,14 +841,14 @@ operator_lt::op2_range (irange &r, tree type,
 {
   switch (get_bool_state (r, lhs, type))
     {
-    case BRS_FALSE:
-      build_le (r, type, op1.upper_bound ());
-      break;
-
     case BRS_TRUE:
       build_gt (r, type, op1.lower_bound ());
       break;
 
+    case BRS_FALSE:
+      build_le (r, type, op1.upper_bound ());
+      break;
+
     default:
       break;
     }
@@ -952,14 +952,14 @@ operator_le::op2_range (irange &r, tree type,
 {
   switch (get_bool_state (r, lhs, type))
     {
-    case BRS_FALSE:
-      build_lt (r, type, op1.upper_bound ());
-      break;
-
     case BRS_TRUE:
       build_ge (r, type, op1.lower_bound ());
       break;
 
+    case BRS_FALSE:
+      build_lt (r, type, op1.upper_bound ());
+      break;
+
     default:
       break;
     }
@@ -1062,14 +1062,14 @@ operator_gt::op2_range (irange &r, tree type,
 {
   switch (get_bool_state (r, lhs, type))
     {
-    case BRS_FALSE:
-      build_ge (r, type, op1.lower_bound ());
-      break;
-
     case BRS_TRUE:
       build_lt (r, type, op1.upper_bound ());
       break;
 
+    case BRS_FALSE:
+      build_ge (r, type, op1.lower_bound ());
+      break;
+
     default:
       break;
     }
@@ -1173,14 +1173,14 @@ operator_ge::op2_range (irange &r, tree type,
 {
   switch (get_bool_state (r, lhs, type))
     {
-    case BRS_FALSE:
-      build_gt (r, type, op1.lower_bound ());
-      break;
-
     case BRS_TRUE:
       build_le (r, type, op1.upper_bound ());
       break;
 
+    case BRS_FALSE:
+      build_gt (r, type, op1.lower_bound ());
+      break;
+
     default:
       break;
     }
-- 
2.37.3

Reply via email to