public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/105629] [13 Regression] g++.dg/opt/pr94589-2.C for cris, m68k, s390x
Date: Mon, 23 May 2022 09:15:57 +0000	[thread overview]
Message-ID: <bug-105629-4-3j9yM3KYTZ@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-105629-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105629

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org
             Status|UNCONFIRMED                 |ASSIGNED
           Priority|P3                          |P1
   Last reconfirmed|                            |2022-05-23
             Target|                            |x86_64-*-*
     Ever confirmed|0                           |1
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot gnu.org

--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> ---
Thanks, so the relevant IL change is probably

  # c$_M_value_3 = PHI <-1(3), 0(2), 2(5), 1(4)>
  _11 = (unsigned char) c$_M_value_3;
  _16 = _11 <= 1;

vs

  # c$_M_value_3 = PHI <-1(3), 0(2), 2(5), 1(4)>
  _11 = (unsigned int) c$_M_value_3;
  _16 = _11 <= 1;

where the conversion from c$_M_value_3 is now sign-extending which is something
spaceship_replacement does not expect.  We how do

Matching expression match.pd:2114, generic-match.cc:676
Matching expression match.pd:2121, generic-match.cc:736
Applying pattern match.pd:5497, generic-match.cc:23783   (****)
Matching expression match.pd:2114, generic-match.cc:676
Matching expression match.pd:2121, generic-match.cc:736
Matching expression match.pd:2126, generic-match.cc:776
Applying pattern match.pd:5868, generic-match.cc:62355
Applying pattern match.pd:3662, generic-match.cc:27474
Applying pattern match.pd:3742, generic-match.cc:26853
Applying pattern match.pd:3648, generic-match.cc:27432

;; Function constexpr bool std::operator>=(partial_ordering,
__cmp_cat::__unspec) (null)
;; enabled by -tree-original


<<< Unknown tree: must_not_throw_expr
  return <retval> = (unsigned int) __v._M_value <= 1
   >>>;

with the marked (****) folding that eventually you re-disable for GENERIC.

In the end we use .SPACESHIP on x86_64 but end up with

bool f17 (double i)
{
  bool _2;
  int _7;
  bool prephitmp_8;

  <bb 2> [local count: 1073741824]:
  _7 = .SPACESHIP (i_1(D), 5.0e+0);
  if (_7 != 0)
    goto <bb 3>; [50.00%]
  else
    goto <bb 5>; [50.00%]

  <bb 3> [local count: 536870913]:
  if (_7 == 1)
    goto <bb 4>; [50.00%]
  else
    goto <bb 5>; [50.00%]

  <bb 4> [local count: 268435456]:
  _2 = i_1(D) > 5.0e+0;

  <bb 5> [local count: 1073741824]:
  # prephitmp_8 = PHI <1(2), _2(4), 0(3)>
  return prephitmp_8;

which is a regression from GCC 12.  I think the non-widening constraint can
be relaxed.  Indeed the following fixes it - Jakub, is there anything
that would prevent sign-extending to work?

diff --git a/gcc/tree-ssa-phiopt.cc b/gcc/tree-ssa-phiopt.cc
index 8c9c46d41f1..e61d9736937 100644
--- a/gcc/tree-ssa-phiopt.cc
+++ b/gcc/tree-ssa-phiopt.cc
@@ -2217,7 +2217,7 @@ spaceship_replacement (basic_block cond_bb, basic_block
middle_bb,

       if (!TYPE_UNSIGNED (ty2) || !INTEGRAL_TYPE_P (ty2))
        return false;
-      if (TYPE_PRECISION (ty1) != TYPE_PRECISION (ty2))
+      if (TYPE_PRECISION (ty1) > TYPE_PRECISION (ty2))
        return false;
       if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (orig_use_lhs))
        return false;

  parent reply	other threads:[~2022-05-23  9:15 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-17 15:22 [Bug middle-end/105629] New: " hp at gcc dot gnu.org
2022-05-18 12:37 ` [Bug middle-end/105629] " rguenth at gcc dot gnu.org
2022-05-19 22:40 ` hp at gcc dot gnu.org
2022-05-20  6:07 ` rguenther at suse dot de
2022-05-20 11:43 ` hp at gcc dot gnu.org
2022-05-20 11:46 ` rguenther at suse dot de
2022-05-20 21:55 ` hp at gcc dot gnu.org
2022-05-21  1:26 ` hp at gcc dot gnu.org
2022-05-23  9:15 ` rguenth at gcc dot gnu.org [this message]
2022-05-24  6:20 ` cvs-commit at gcc dot gnu.org
2022-05-24  6:21 ` rguenth at gcc dot gnu.org
2022-05-24 14:02 ` hp at gcc dot gnu.org

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=bug-105629-4-3j9yM3KYTZ@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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).