]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Move TRUE case first in range-op.cc.
authorAldy Hernandez <aldyh@redhat.com>
Tue, 11 Oct 2022 09:20:25 +0000 (11:20 +0200)
committerAldy Hernandez <aldyh@redhat.com>
Tue, 11 Oct 2022 13:52:24 +0000 (15:52 +0200)
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

index df0735cb42a837577859ef322ac8920c539e0d5a..4d5a033dfa5fb1c07d58ae552e546fdc6c5c28b8 100644 (file)
@@ -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;
     }