public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/49997] New: ICE in inline_small_functions with -fnon-call-exceptions
@ 2011-08-05 21:55 arthur.j.odwyer at gmail dot com
  2011-08-08  9:44 ` [Bug tree-optimization/49997] [4.7 Regression] " rguenth at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: arthur.j.odwyer at gmail dot com @ 2011-08-05 21:55 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49997

           Summary: ICE in inline_small_functions with
                    -fnon-call-exceptions
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: arthur.j.odwyer@gmail.com


Created attachment 24928
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24928
Output of "ajo-gcc -w -O2 -finline-functions -fnon-call-exceptions -c test.c
-v"

This failure reproduces for me with svn revision 177466 (2011-08-05), going
back at least as far as 2011-08-02. I'm on Ubuntu 10.10, x86-64.

cat >test.c <<EOF
extern int g_78, g_223;
static int MOD(int si1, int si2) {
  return (!si2 || (!si1 && si2)) ? si1 : (si1 % 3);
}
void func_65(int p_66) {
    g_78 = MOD(p_66, 3);
}
void func_54(int si1) {
    func_65(0);
    func_65(1);
    func_65(2);
    while (g_223) {
        MOD(si1, 3);
        func_65(3);
        func_65(4);
        func_65(5);
        func_65(6);
        func_65(7);
        func_65(8);
    }
}
EOF
gcc -w -O2 -finline-functions -fnon-call-exceptions -c test.c

test.c:21:1: internal compiler error: in inline_small_functions, at
ipa-inline.c:1405


This test case is reduced from the output of Csmith 2.1.0 (git hash 210eda7,
https://github.com/Quuxplusone/csmith/), using the following command line:
csmith --paranoid --no-longlong --no-pointers --no-arrays --no-jumps --consts
--no-volatiles --no-checksum --divs --muls --bitfields --packed-struct -s
533966876


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug tree-optimization/49997] [4.7 Regression] ICE in inline_small_functions with -fnon-call-exceptions
  2011-08-05 21:55 [Bug tree-optimization/49997] New: ICE in inline_small_functions with -fnon-call-exceptions arthur.j.odwyer at gmail dot com
@ 2011-08-08  9:44 ` rguenth at gcc dot gnu.org
  2011-09-06 14:06 ` hubicka at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-08-08  9:44 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49997

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2011.08.08 09:43:59
      Known to work|                            |4.6.1
   Target Milestone|---                         |4.7.0
            Summary|ICE in                      |[4.7 Regression] ICE in
                   |inline_small_functions with |inline_small_functions with
                   |-fnon-call-exceptions       |-fnon-call-exceptions
     Ever Confirmed|0                           |1

--- Comment #1 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-08-08 09:43:59 UTC ---
Confirmed.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug tree-optimization/49997] [4.7 Regression] ICE in inline_small_functions with -fnon-call-exceptions
  2011-08-05 21:55 [Bug tree-optimization/49997] New: ICE in inline_small_functions with -fnon-call-exceptions arthur.j.odwyer at gmail dot com
  2011-08-08  9:44 ` [Bug tree-optimization/49997] [4.7 Regression] " rguenth at gcc dot gnu.org
@ 2011-09-06 14:06 ` hubicka at gcc dot gnu.org
  2011-09-06 15:49 ` rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: hubicka at gcc dot gnu.org @ 2011-09-06 14:06 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49997

--- Comment #2 from Jan Hubicka <hubicka at gcc dot gnu.org> 2011-09-06 14:06:29 UTC ---
Hmm,
the problem is that with inline predicates the overall growth depends not only
on number of calls, but also at information known about call site.  This
information could potentially change every time function containing the call
site gets inlined.  This breaks the optimization avoiding update in
inline_small_functions.  The following hack fixes the problem, but the test was
added to avoid really bad quadratic behaviour when compiling cc1 with LTO.
I will need to benchmark it and probably add parameter limitting key updating
for single inline action.

Index: ipa-inline.c
===================================================================
--- ipa-inline.c        (revision 178592)
+++ ipa-inline.c        (working copy)
@@ -1514,7 +1515,7 @@ inline_small_functions (void)
          /* We inlined last offline copy to the body.  This might lead
             to callees of function having fewer call sites and thus they
             may need updating.  */
-         if (callee->global.inlined_to)
+         if (callee->global.inlined_to || 1)
            update_all_callee_keys (heap, callee, updated_nodes);
          else
            update_callee_keys (heap, edge->callee, updated_nodes);


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug tree-optimization/49997] [4.7 Regression] ICE in inline_small_functions with -fnon-call-exceptions
  2011-08-05 21:55 [Bug tree-optimization/49997] New: ICE in inline_small_functions with -fnon-call-exceptions arthur.j.odwyer at gmail dot com
  2011-08-08  9:44 ` [Bug tree-optimization/49997] [4.7 Regression] " rguenth at gcc dot gnu.org
  2011-09-06 14:06 ` hubicka at gcc dot gnu.org
@ 2011-09-06 15:49 ` rguenth at gcc dot gnu.org
  2011-09-09  9:06 ` hubicka at ucw dot cz
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-09-06 15:49 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49997

--- Comment #3 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-09-06 15:48:32 UTC ---
Or finally drop the key dependence on the number of callers.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug tree-optimization/49997] [4.7 Regression] ICE in inline_small_functions with -fnon-call-exceptions
  2011-08-05 21:55 [Bug tree-optimization/49997] New: ICE in inline_small_functions with -fnon-call-exceptions arthur.j.odwyer at gmail dot com
                   ` (2 preceding siblings ...)
  2011-09-06 15:49 ` rguenth at gcc dot gnu.org
@ 2011-09-09  9:06 ` hubicka at ucw dot cz
  2011-09-11 10:06 ` hubicka at ucw dot cz
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: hubicka at ucw dot cz @ 2011-09-09  9:06 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49997

--- Comment #4 from Jan Hubicka <hubicka at ucw dot cz> 2011-09-09 08:43:16 UTC ---
> Or finally drop the key dependence on the number of callers.

Possibly. Last time I tried it it however lead to bigger and slower binaries.
Well, I will patch frescobaldi today and lets see.

Honza


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug tree-optimization/49997] [4.7 Regression] ICE in inline_small_functions with -fnon-call-exceptions
  2011-08-05 21:55 [Bug tree-optimization/49997] New: ICE in inline_small_functions with -fnon-call-exceptions arthur.j.odwyer at gmail dot com
                   ` (3 preceding siblings ...)
  2011-09-09  9:06 ` hubicka at ucw dot cz
@ 2011-09-11 10:06 ` hubicka at ucw dot cz
  2011-10-10 12:13 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: hubicka at ucw dot cz @ 2011-09-11 10:06 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49997

--- Comment #5 from Jan Hubicka <hubicka at ucw dot cz> 2011-09-11 09:42:32 UTC ---
> Possibly. Last time I tried it it however lead to bigger and slower binaries.
> Well, I will patch frescobaldi today and lets see.
OK, removing this trick alone regress tramp3d by about 80%,and capacita by
about 15%.
Causes small regression on wave & nbench.
reduces size a bit for dlv.

The reason for this is to drive heuristic to preffer functions that can
ultimately be fully inlined wihtout much of effort.  Frankly I think this makes
sense.  We could of course reach this otherwise. Like compute expected growths
just once
and expect that other inlining won't affect them in important way (that si
wrong of course)
and/or just cut the update algorithm by fixed threshold allowing priority queue
to ba
partly out of date when we run into the most expensive cases.

Honza


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug tree-optimization/49997] [4.7 Regression] ICE in inline_small_functions with -fnon-call-exceptions
  2011-08-05 21:55 [Bug tree-optimization/49997] New: ICE in inline_small_functions with -fnon-call-exceptions arthur.j.odwyer at gmail dot com
                   ` (4 preceding siblings ...)
  2011-09-11 10:06 ` hubicka at ucw dot cz
@ 2011-10-10 12:13 ` rguenth at gcc dot gnu.org
  2011-12-06 13:45 ` rguenth at gcc dot gnu.org
  2011-12-06 13:46 ` rguenth at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-10-10 12:13 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49997

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug tree-optimization/49997] [4.7 Regression] ICE in inline_small_functions with -fnon-call-exceptions
  2011-08-05 21:55 [Bug tree-optimization/49997] New: ICE in inline_small_functions with -fnon-call-exceptions arthur.j.odwyer at gmail dot com
                   ` (5 preceding siblings ...)
  2011-10-10 12:13 ` rguenth at gcc dot gnu.org
@ 2011-12-06 13:45 ` rguenth at gcc dot gnu.org
  2011-12-06 13:46 ` rguenth at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-12-06 13:45 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49997

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |WORKSFORME

--- Comment #7 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-12-06 13:45:44 UTC ---
This particular testcase no longer ICEs for me.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug tree-optimization/49997] [4.7 Regression] ICE in inline_small_functions with -fnon-call-exceptions
  2011-08-05 21:55 [Bug tree-optimization/49997] New: ICE in inline_small_functions with -fnon-call-exceptions arthur.j.odwyer at gmail dot com
                   ` (6 preceding siblings ...)
  2011-12-06 13:45 ` rguenth at gcc dot gnu.org
@ 2011-12-06 13:46 ` rguenth at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-12-06 13:46 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49997

--- Comment #6 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-12-06 13:45:28 UTC ---
Author: rguenth
Date: Tue Dec  6 13:45:19 2011
New Revision: 182049

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=182049
Log:
2011-12-06  Richard Guenther  <rguenther@suse.de>

    PR tree-optimization/49997
    * gcc.dg/torture/pr49997.c: New testcase.

Added:
    trunk/gcc/testsuite/gcc.dg/torture/pr49997.c
Modified:
    trunk/gcc/testsuite/ChangeLog


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2011-12-06 13:46 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-05 21:55 [Bug tree-optimization/49997] New: ICE in inline_small_functions with -fnon-call-exceptions arthur.j.odwyer at gmail dot com
2011-08-08  9:44 ` [Bug tree-optimization/49997] [4.7 Regression] " rguenth at gcc dot gnu.org
2011-09-06 14:06 ` hubicka at gcc dot gnu.org
2011-09-06 15:49 ` rguenth at gcc dot gnu.org
2011-09-09  9:06 ` hubicka at ucw dot cz
2011-09-11 10:06 ` hubicka at ucw dot cz
2011-10-10 12:13 ` rguenth at gcc dot gnu.org
2011-12-06 13:45 ` rguenth at gcc dot gnu.org
2011-12-06 13:46 ` rguenth at gcc dot gnu.org

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).