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 ipa/98834] [10/11 Regression] Code path incorrectly determined to be unreachable
Date: Tue, 26 Jan 2021 09:18:16 +0000	[thread overview]
Message-ID: <bug-98834-4-hmkRITZOcY@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-98834-4@http.gcc.gnu.org/bugzilla/>

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2021-01-26
           Keywords|                            |needs-bisection, wrong-code
                 CC|                            |jamborm at gcc dot gnu.org,
                   |                            |marxin at gcc dot gnu.org
     Ever confirmed|0                           |1
          Component|tree-optimization           |ipa
   Target Milestone|---                         |10.3
           Priority|P3                          |P2
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed, the __builtin_unreachable is introduced by inlining:

Considering _S_multiplies.isra/23 with 12 size
 to be inlined into int main()/13 in t.C:54
 Estimated badness is -inf, frequency 1.00.
    Badness calculation for int main()/13 -> _S_multiplies.isra/23
      size growth -2, time 2.000000 unspec 10.000000 IPA hints: declared_inline
big_speedup
      -inf: Growth -2 <= 0
      Adjusted by hints -inf
                Accounting size:2.00, time:2.00 on predicate exec:(true)
Introduced new external node (void __builtin_unreachable()/24).
Processing frequency _S_multiplies.isra/23
  Called by int main()/13 that is executed once
                Accounting size:-4.00, time:-13.00 on predicate exec:(true)
t.C:54:62: optimized:  Inlined _S_multiplies.isra/23 into int main()/13 which
now has time 8.000000 and size 9, net change of -14.

which points to IPA SRA.  VRP then simplifies __builtin_constant_p seen as

  _12 = __builtin_constant_p (__xx_11);
  if (_12 != 0)
    goto <bb 4>; [100.00%]
  else
    goto <bb 3>; [0.00%]

  <bb 3> [count: 0]:
  __builtin_unreachable ();

  <bb 4> [local count: 1073741824]:
  MEM <int> [(struct _Tuple *)&D.2557] = 0;

and uses conservatively false but that runs into __builtin_unreachable () ...

The IPA inline transform ends us with

  _12 = __builtin_constant_p (__xx_11);
  if (_12 != 0)
    goto <bb 4>; [100.00%]
  else
    goto <bb 3>; [0.00%]

  <bb 3> [count: 0]:
  _13 = _16(D);
  __builtin_unreachable ();

  <bb 4> [local count: 1073741824]:
  # SR.30_15 = PHI <__y_10(2)>

which eventually shows the reason (the unused argument?)

  reply	other threads:[~2021-01-26  9:18 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-26  8:28 [Bug tree-optimization/98834] New: " kretz at kde dot org
2021-01-26  9:18 ` rguenth at gcc dot gnu.org [this message]
2021-01-26  9:20 ` [Bug ipa/98834] [10/11 Regression] " kretz at kde dot org
2021-01-26  9:29 ` kretz at kde dot org
2021-01-26  9:47 ` jakub at gcc dot gnu.org
2021-01-26 10:09 ` rguenther at suse dot de
2021-03-08 18:10 ` jamborm at gcc dot gnu.org
2021-03-15 12:40 ` rguenth at gcc dot gnu.org
2021-03-15 15:00 ` cvs-commit at gcc dot gnu.org
2021-03-15 15:02 ` rguenth at gcc dot gnu.org
2021-03-16  9:29 ` marxin at gcc dot gnu.org
2021-03-24 13:12 ` [Bug ipa/98834] [10 " rguenth at gcc dot gnu.org
2021-03-24 14:26 ` cvs-commit at gcc dot gnu.org
2021-03-24 14:27 ` rguenth 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-98834-4-hmkRITZOcY@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).