From: Aldy Hernandez <aldyh@redhat.com>
To: GCC patches <gcc-patches@gcc.gnu.org>
Cc: Andrew MacLeod <amacleod@redhat.com>, Aldy Hernandez <aldyh@redhat.com>
Subject: [COMMITTED] Move TRUE case first in range-op.cc.
Date: Tue, 11 Oct 2022 15:51:33 +0200 [thread overview]
Message-ID: <20221011135136.369644-1-aldyh@redhat.com> (raw)
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
next reply other threads:[~2022-10-11 13:51 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-11 13:51 Aldy Hernandez [this message]
2022-10-11 13:51 ` [COMMITTED] Share common ordered comparison code with UN*_EXPR Aldy Hernandez
2022-10-11 13:51 ` [COMMITTED] Implement op1_range operators for unordered comparisons Aldy Hernandez
2022-10-11 13:57 ` Aldy Hernandez
2022-10-11 13:51 ` [COMMITTED] Implement ABS_EXPR operator for frange Aldy Hernandez
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221011135136.369644-1-aldyh@redhat.com \
--to=aldyh@redhat.com \
--cc=amacleod@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).