public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/103052] New: Function call omitted at -O1 optimization level.
@ 2021-11-02 21:45 tor at ccxvii dot net
  2021-11-02 22:04 ` [Bug c/103052] " jakub at gcc dot gnu.org
                   ` (16 more replies)
  0 siblings, 17 replies; 18+ messages in thread
From: tor at ccxvii dot net @ 2021-11-02 21:45 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 103052
           Summary: Function call omitted at -O1 optimization level.
           Product: gcc
           Version: 10.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tor at ccxvii dot net
  Target Milestone: ---

Created attachment 51724
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51724&action=edit
xxx.c

With the attached sample program the function call to checkfutureword() in
main() is completely omitted if compiled with gcc -O1. With -O0 or -O2 or
greater the function is called as expected.

Changing any line in the program is likely to make the bug disappear, and
reordering the functions within the file can also make the bug appear and
disappear.

The example is from a much larger program cut down to the very smallest I could
make it and still replicate the bug.

$ gcc -O0 xxx.c && ./a.out
SUCCESS: exit with exception as expected!

$ gcc -O1 xxx.c && ./a.out
FAIL: should NOT get here :(

The output of gcc -v:

Using built-in specs.
COLLECT_GCC=/usr/bin/gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/10/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa:hsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 10.3.0-11'
--with-bugurl=file:///usr/share/doc/gcc-10/README.Bugs
--enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,m2 --prefix=/usr
--with-gcc-major-version-only --program-suffix=-10
--program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes
--with-default-libstdcxx-abi=new --enable-gnu-unique-object
--disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib
--enable-libphobos-checking=release --with-target-system-zlib=auto
--enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686
--with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib
--with-tune=generic
--enable-offload-targets=nvptx-none=/build/gcc-10-Fsusqo/gcc-10-10.3.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-10-Fsusqo/gcc-10-10.3.0/debian/tmp-gcn/usr,hsa
--without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=x86_64-linux-gnu
--with-build-config=bootstrap-lto-lean --enable-link-mutex
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 10.3.0 (Debian 10.3.0-11)

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

* [Bug c/103052] Function call omitted at -O1 optimization level.
  2021-11-02 21:45 [Bug c/103052] New: Function call omitted at -O1 optimization level tor at ccxvii dot net
@ 2021-11-02 22:04 ` jakub at gcc dot gnu.org
  2021-11-02 22:09 ` tor at ccxvii dot net
                   ` (15 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-11-02 22:04 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Works just fine with gcc version 10.3.1 20210422 (Red Hat 10.3.1-1) (GCC)

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

* [Bug c/103052] Function call omitted at -O1 optimization level.
  2021-11-02 21:45 [Bug c/103052] New: Function call omitted at -O1 optimization level tor at ccxvii dot net
  2021-11-02 22:04 ` [Bug c/103052] " jakub at gcc dot gnu.org
@ 2021-11-02 22:09 ` tor at ccxvii dot net
  2021-11-02 22:15 ` [Bug middle-end/103052] " pinskia at gcc dot gnu.org
                   ` (14 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: tor at ccxvii dot net @ 2021-11-02 22:09 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Tor Andersson <tor at ccxvii dot net> ---
Same problem with gcc-11.

$ gcc-11 -O1 xxx.c && ./a.out 
FAIL: should NOT get here :(

$ gcc-11 -v
Using built-in specs.
COLLECT_GCC=/usr/bin/gcc-11
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/11/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 11.2.0-10'
--with-bugurl=file:///usr/share/doc/gcc-11/README.Bugs
--enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,m2 --prefix=/usr
--with-gcc-major-version-only --program-suffix=-11
--program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes
--with-default-libstdcxx-abi=new --enable-gnu-unique-object
--disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib
--enable-libphobos-checking=release --with-target-system-zlib=auto
--enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet
--with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32
--enable-multilib --with-tune=generic
--enable-offload-targets=nvptx-none=/build/gcc-11-9Chg0b/gcc-11-11.2.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-11-9Chg0b/gcc-11-11.2.0/debian/tmp-gcn/usr
--without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=x86_64-linux-gnu
--with-build-config=bootstrap-lto-lean --enable-link-serialization=2
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.2.0 (Debian 11.2.0-10)

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

* [Bug middle-end/103052] Function call omitted at -O1 optimization level.
  2021-11-02 21:45 [Bug c/103052] New: Function call omitted at -O1 optimization level tor at ccxvii dot net
  2021-11-02 22:04 ` [Bug c/103052] " jakub at gcc dot gnu.org
  2021-11-02 22:09 ` tor at ccxvii dot net
@ 2021-11-02 22:15 ` pinskia at gcc dot gnu.org
  2021-11-02 22:16 ` [Bug middle-end/103052] [9/10/11/12 Regression] " pinskia at gcc dot gnu.org
                   ` (13 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-11-02 22:15 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
          Component|c                           |middle-end

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Still fails on the trunk.

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

* [Bug middle-end/103052] [9/10/11/12 Regression] Function call omitted at -O1 optimization level.
  2021-11-02 21:45 [Bug c/103052] New: Function call omitted at -O1 optimization level tor at ccxvii dot net
                   ` (2 preceding siblings ...)
  2021-11-02 22:15 ` [Bug middle-end/103052] " pinskia at gcc dot gnu.org
@ 2021-11-02 22:16 ` pinskia at gcc dot gnu.org
  2021-11-02 22:19 ` tor at ccxvii dot net
                   ` (12 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-11-02 22:16 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |9.5
            Summary|Function call omitted at    |[9/10/11/12 Regression]
                   |-O1 optimization level.     |Function call omitted at
                   |                            |-O1 optimization level.

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

* [Bug middle-end/103052] [9/10/11/12 Regression] Function call omitted at -O1 optimization level.
  2021-11-02 21:45 [Bug c/103052] New: Function call omitted at -O1 optimization level tor at ccxvii dot net
                   ` (3 preceding siblings ...)
  2021-11-02 22:16 ` [Bug middle-end/103052] [9/10/11/12 Regression] " pinskia at gcc dot gnu.org
@ 2021-11-02 22:19 ` tor at ccxvii dot net
  2021-11-02 22:39 ` [Bug ipa/103052] " pinskia at gcc dot gnu.org
                   ` (11 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: tor at ccxvii dot net @ 2021-11-02 22:19 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Tor Andersson <tor at ccxvii dot net> ---
I can make it succeed with -O1 if I add the -fipa-pure-const flag, if that can
help tracking down.

$ gcc -O1 xxx.c && ./a.out 
FAIL: should NOT get here :(

$ gcc -O1 -fno-ipa-pure-const xxx.c && ./a.out 
SUCCESS: exit with exception as expected!

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

* [Bug ipa/103052] [9/10/11/12 Regression] Function call omitted at -O1 optimization level.
  2021-11-02 21:45 [Bug c/103052] New: Function call omitted at -O1 optimization level tor at ccxvii dot net
                   ` (4 preceding siblings ...)
  2021-11-02 22:19 ` tor at ccxvii dot net
@ 2021-11-02 22:39 ` pinskia at gcc dot gnu.org
  2021-11-02 22:41 ` pinskia at gcc dot gnu.org
                   ` (10 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-11-02 22:39 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|middle-end                  |ipa
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2021-11-02
                 CC|                            |marxin at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
In DCE:
Eliminating unnecessary statements:
Deleting : checkfutureword ("const");


i.pure-const:
Declaration updated to be pure: checkfutureword/26
Starting cycle
  Visiting main/28 state:const looping 0
    Call to abort/30 ignoring side effects->pure looping
    Call to puts/29 ignoring side effects->pure looping
    Call to checkfutureword/26 state:pure looping:0

Confirmed.

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

* [Bug ipa/103052] [9/10/11/12 Regression] Function call omitted at -O1 optimization level.
  2021-11-02 21:45 [Bug c/103052] New: Function call omitted at -O1 optimization level tor at ccxvii dot net
                   ` (5 preceding siblings ...)
  2021-11-02 22:39 ` [Bug ipa/103052] " pinskia at gcc dot gnu.org
@ 2021-11-02 22:41 ` pinskia at gcc dot gnu.org
  2021-11-03  8:31 ` [Bug ipa/103052] [9/10/11/12 Regression] Function is found to be pure looping but has a call to a noreturn function in it rguenth at gcc dot gnu.org
                   ` (9 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-11-02 22:41 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|                            |10.3.0, 11.2.0

--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
A better self-contained testcase, using builtins:
static void js_error(void);
static int top;
static void js_throw(void)
{
        __builtin_exit(0);
}

// LOCATION A -- if js_pop is here, the bug is present
static void js_pop(void)
{
        if (++top > 100)
                js_error();
}

static void jsC_error(const char *v)
{
        if (v[0] == 0)
                js_error();
        js_throw();
}
static void checkfutureword(const char *exp)
{
        if (!__builtin_strcmp(exp, "const"))
                jsC_error("boom");
}
static void js_error(void) {
        checkfutureword("foo");
        checkfutureword("bar");
        js_pop();
}
int main(void)
{
        checkfutureword("const");
        __builtin_abort ();
}

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

* [Bug ipa/103052] [9/10/11/12 Regression] Function is found to be pure looping but has a call to a noreturn function in it
  2021-11-02 21:45 [Bug c/103052] New: Function call omitted at -O1 optimization level tor at ccxvii dot net
                   ` (6 preceding siblings ...)
  2021-11-02 22:41 ` pinskia at gcc dot gnu.org
@ 2021-11-03  8:31 ` rguenth at gcc dot gnu.org
  2021-11-03  8:35 ` marxin at gcc dot gnu.org
                   ` (8 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-11-03  8:31 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hubicka at gcc dot gnu.org,
                   |                            |rguenth at gcc dot gnu.org
           Priority|P3                          |P2

--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> ---
I believe a possible noreturn should make the function LOOPING_{CONST,PURE}
(LOOPING as in possibly not normally returning).  Can we bisect this?

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

* [Bug ipa/103052] [9/10/11/12 Regression] Function is found to be pure looping but has a call to a noreturn function in it
  2021-11-02 21:45 [Bug c/103052] New: Function call omitted at -O1 optimization level tor at ccxvii dot net
                   ` (7 preceding siblings ...)
  2021-11-03  8:31 ` [Bug ipa/103052] [9/10/11/12 Regression] Function is found to be pure looping but has a call to a noreturn function in it rguenth at gcc dot gnu.org
@ 2021-11-03  8:35 ` marxin at gcc dot gnu.org
  2021-11-03  8:44 ` hubicka at gcc dot gnu.org
                   ` (7 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-11-03  8:35 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Martin Liška <marxin at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #7)
> I believe a possible noreturn should make the function LOOPING_{CONST,PURE}
> (LOOPING as in possibly not normally returning).  Can we bisect this?

Sure, it's quite hairy, started with r6-5479-gd8e3e8a57158160d.

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

* [Bug ipa/103052] [9/10/11/12 Regression] Function is found to be pure looping but has a call to a noreturn function in it
  2021-11-02 21:45 [Bug c/103052] New: Function call omitted at -O1 optimization level tor at ccxvii dot net
                   ` (8 preceding siblings ...)
  2021-11-03  8:35 ` marxin at gcc dot gnu.org
@ 2021-11-03  8:44 ` hubicka at gcc dot gnu.org
  2021-11-19 12:47 ` hubicka at gcc dot gnu.org
                   ` (6 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: hubicka at gcc dot gnu.org @ 2021-11-03  8:44 UTC (permalink / raw)
  To: gcc-bugs

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

Jan Hubicka <hubicka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |hubicka at gcc dot gnu.org

--- Comment #9 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
mine.

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

* [Bug ipa/103052] [9/10/11/12 Regression] Function is found to be pure looping but has a call to a noreturn function in it
  2021-11-02 21:45 [Bug c/103052] New: Function call omitted at -O1 optimization level tor at ccxvii dot net
                   ` (9 preceding siblings ...)
  2021-11-03  8:44 ` hubicka at gcc dot gnu.org
@ 2021-11-19 12:47 ` hubicka at gcc dot gnu.org
  2021-11-20 23:35 ` cvs-commit at gcc dot gnu.org
                   ` (5 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: hubicka at gcc dot gnu.org @ 2021-11-19 12:47 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #10 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
There is wrong order of conditionals in code merging previously known info with
current info. IPA propagation gets state NEITHER by walking around the
non-trivial cycle while function was earlier detected as PURE.

It is bit weird that IPA code does not ndetect PURE like local code. The catch
is that we get SCC involving noreturn edge which is not really a SCC for pure
analysis but it is SCC for const (since noreturn functions never modify global
memory after returning)

diff --git a/gcc/ipa-pure-const.c b/gcc/ipa-pure-const.c
index a332940b55d..b438eb718a1 100644
--- a/gcc/ipa-pure-const.c
+++ b/gcc/ipa-pure-const.c
@@ -1782,9 +1782,9 @@ propagate_pure_const (void)
          if (w_l->state_previously_known != IPA_NEITHER
              && this_state > w_l->state_previously_known)
            {
-              this_state = w_l->state_previously_known;
              if (this_state == IPA_NEITHER)
-               this_looping = w_l->looping_previously_known;
+               this_looping = w_l->looping_previously_known;
+              this_state = w_l->state_previously_known;
            }
          if (!this_looping && self_recursive_p (w))
            this_looping = true;

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

* [Bug ipa/103052] [9/10/11/12 Regression] Function is found to be pure looping but has a call to a noreturn function in it
  2021-11-02 21:45 [Bug c/103052] New: Function call omitted at -O1 optimization level tor at ccxvii dot net
                   ` (10 preceding siblings ...)
  2021-11-19 12:47 ` hubicka at gcc dot gnu.org
@ 2021-11-20 23:35 ` cvs-commit at gcc dot gnu.org
  2021-11-20 23:40 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-11-20 23:35 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #11 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jan Hubicka <hubicka@gcc.gnu.org>:

https://gcc.gnu.org/g:a0e99d5bb741d3db74a67d492f47b28217fbf88a

commit r12-5433-ga0e99d5bb741d3db74a67d492f47b28217fbf88a
Author: Jan Hubicka <jh@suse.cz>
Date:   Sun Nov 21 00:35:22 2021 +0100

    Fix looping flag discovery in ipa-pure-const

    The testcase shows situation where there is non-trivial cycle in the
callgraph
    involving a noreturn call.  This cycle is important for const function
discovery
    but not important for pure.  IPA pure const uses same strongly connected
    components for both propagations which makes it to get suboptimal result
    (does not detect the pure flag). However local pure const gets the
situation
    right becaue it processes functions in right order.  This hits rarely
    executed code in propagate_pure_const that merge results with previously
    known state that has long standing bug in it that makes it to throw away
    the looping flag.

    Bootstrapped/regtested x86_64-linux.

    gcc/ChangeLog:

    2021-11-21  Jan Hubicka  <hubicka@ucw.cz>

            PR ipa/103052
            * ipa-pure-const.c (propagate_pure_const): Fix merging of loping
flag.

    gcc/testsuite/ChangeLog:

    2021-11-21  Jan Hubicka  <hubicka@ucw.cz>

            PR ipa/103052
            * gcc.c-torture/execute/pr103052.c: New test.

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

* [Bug ipa/103052] [9/10/11/12 Regression] Function is found to be pure looping but has a call to a noreturn function in it
  2021-11-02 21:45 [Bug c/103052] New: Function call omitted at -O1 optimization level tor at ccxvii dot net
                   ` (11 preceding siblings ...)
  2021-11-20 23:35 ` cvs-commit at gcc dot gnu.org
@ 2021-11-20 23:40 ` cvs-commit at gcc dot gnu.org
  2021-11-25 11:25 ` [Bug ipa/103052] [9/10/11 " cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-11-20 23:40 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #12 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jan Hubicka <hubicka@gcc.gnu.org>:

https://gcc.gnu.org/g:ce2dbf943ac8ffefe048016ac3abfd3b6a4518d4

commit r12-5434-gce2dbf943ac8ffefe048016ac3abfd3b6a4518d4
Author: Jan Hubicka <jh@suse.cz>
Date:   Sun Nov 21 00:39:42 2021 +0100

    Fix ignore_nondeterminism_p in ipa-modref

    Improve debug output in ipa-modref and fix ignore_nondeterminism predicate:
    looping pures and cont are still deterministic.

    gcc/ChangeLog:

    2021-11-21  Jan Hubicka  <hubicka@ucw.cz>

            PR ipa/103052
            * ipa-modref.c (ignore_nondeterminism_p): Allow looping pure/cont.
            (merge_call_side_effects): Improve debug output.

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

* [Bug ipa/103052] [9/10/11 Regression] Function is found to be pure looping but has a call to a noreturn function in it
  2021-11-02 21:45 [Bug c/103052] New: Function call omitted at -O1 optimization level tor at ccxvii dot net
                   ` (12 preceding siblings ...)
  2021-11-20 23:40 ` cvs-commit at gcc dot gnu.org
@ 2021-11-25 11:25 ` cvs-commit at gcc dot gnu.org
  2021-11-25 11:29 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-11-25 11:25 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #13 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Jan Hubicka
<hubicka@gcc.gnu.org>:

https://gcc.gnu.org/g:298a4694f89ecb512be8ecba0512558996961fae

commit r10-10294-g298a4694f89ecb512be8ecba0512558996961fae
Author: Jan Hubicka <jh@suse.cz>
Date:   Sun Nov 21 00:35:22 2021 +0100

    Fix looping flag discovery in ipa-pure-const

    The testcase shows situation where there is non-trivial cycle in the
callgraph
    involving a noreturn call.  This cycle is important for const function
discovery
    but not important for pure.  IPA pure const uses same strongly connected
    components for both propagations which makes it to get suboptimal result
    (does not detect the pure flag). However local pure const gets the
situation
    right becaue it processes functions in right order.  This hits rarely
    executed code in propagate_pure_const that merge results with previously
    known state that has long standing bug in it that makes it to throw away
    the looping flag.

    Bootstrapped/regtested x86_64-linux.

    gcc/ChangeLog:

    2021-11-21  Jan Hubicka  <hubicka@ucw.cz>

            PR ipa/103052
            * ipa-pure-const.c (propagate_pure_const): Fix merging of loping
flag.

    gcc/testsuite/ChangeLog:

    2021-11-21  Jan Hubicka  <hubicka@ucw.cz>

            PR ipa/103052
            * gcc.c-torture/execute/pr103052.c: New test.

    (cherry picked from commit a0e99d5bb741d3db74a67d492f47b28217fbf88a)

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

* [Bug ipa/103052] [9/10/11 Regression] Function is found to be pure looping but has a call to a noreturn function in it
  2021-11-02 21:45 [Bug c/103052] New: Function call omitted at -O1 optimization level tor at ccxvii dot net
                   ` (13 preceding siblings ...)
  2021-11-25 11:25 ` [Bug ipa/103052] [9/10/11 " cvs-commit at gcc dot gnu.org
@ 2021-11-25 11:29 ` cvs-commit at gcc dot gnu.org
  2021-11-25 13:29 ` cvs-commit at gcc dot gnu.org
  2021-11-25 13:29 ` hubicka at gcc dot gnu.org
  16 siblings, 0 replies; 18+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-11-25 11:29 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #14 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Jan Hubicka
<hubicka@gcc.gnu.org>:

https://gcc.gnu.org/g:6a1358f7ea1111475e9d46c1535656bdfb2a7904

commit r11-9310-g6a1358f7ea1111475e9d46c1535656bdfb2a7904
Author: Jan Hubicka <jh@suse.cz>
Date:   Sun Nov 21 00:35:22 2021 +0100

    Fix looping flag discovery in ipa-pure-const

    The testcase shows situation where there is non-trivial cycle in the
callgraph
    involving a noreturn call.  This cycle is important for const function
discovery
    but not important for pure.  IPA pure const uses same strongly connected
    components for both propagations which makes it to get suboptimal result
    (does not detect the pure flag). However local pure const gets the
situation
    right becaue it processes functions in right order.  This hits rarely
    executed code in propagate_pure_const that merge results with previously
    known state that has long standing bug in it that makes it to throw away
    the looping flag.

    Bootstrapped/regtested x86_64-linux.

    gcc/ChangeLog:

    2021-11-21  Jan Hubicka  <hubicka@ucw.cz>

            PR ipa/103052
            * ipa-pure-const.c (propagate_pure_const): Fix merging of loping
flag.

    gcc/testsuite/ChangeLog:

    2021-11-21  Jan Hubicka  <hubicka@ucw.cz>

            PR ipa/103052
            * gcc.c-torture/execute/pr103052.c: New test.

    (cherry picked from commit a0e99d5bb741d3db74a67d492f47b28217fbf88a)

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

* [Bug ipa/103052] [9/10/11 Regression] Function is found to be pure looping but has a call to a noreturn function in it
  2021-11-02 21:45 [Bug c/103052] New: Function call omitted at -O1 optimization level tor at ccxvii dot net
                   ` (14 preceding siblings ...)
  2021-11-25 11:29 ` cvs-commit at gcc dot gnu.org
@ 2021-11-25 13:29 ` cvs-commit at gcc dot gnu.org
  2021-11-25 13:29 ` hubicka at gcc dot gnu.org
  16 siblings, 0 replies; 18+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-11-25 13:29 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #15 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-9 branch has been updated by Jan Hubicka
<hubicka@gcc.gnu.org>:

https://gcc.gnu.org/g:3d1f5e86fb4351a109d45fe441b1b00d6e56c277

commit r9-9844-g3d1f5e86fb4351a109d45fe441b1b00d6e56c277
Author: Jan Hubicka <jh@suse.cz>
Date:   Sun Nov 21 00:35:22 2021 +0100

    Fix looping flag discovery in ipa-pure-const

    The testcase shows situation where there is non-trivial cycle in the
callgraph
    involving a noreturn call.  This cycle is important for const function
discovery
    but not important for pure.  IPA pure const uses same strongly connected
    components for both propagations which makes it to get suboptimal result
    (does not detect the pure flag). However local pure const gets the
situation
    right becaue it processes functions in right order.  This hits rarely
    executed code in propagate_pure_const that merge results with previously
    known state that has long standing bug in it that makes it to throw away
    the looping flag.

    Bootstrapped/regtested x86_64-linux.

    gcc/ChangeLog:

    2021-11-21  Jan Hubicka  <hubicka@ucw.cz>

            PR ipa/103052
            * ipa-pure-const.c (propagate_pure_const): Fix merging of loping
flag.

    gcc/testsuite/ChangeLog:

    2021-11-21  Jan Hubicka  <hubicka@ucw.cz>

            PR ipa/103052
            * gcc.c-torture/execute/pr103052.c: New test.

    (cherry picked from commit a0e99d5bb741d3db74a67d492f47b28217fbf88a)

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

* [Bug ipa/103052] [9/10/11 Regression] Function is found to be pure looping but has a call to a noreturn function in it
  2021-11-02 21:45 [Bug c/103052] New: Function call omitted at -O1 optimization level tor at ccxvii dot net
                   ` (15 preceding siblings ...)
  2021-11-25 13:29 ` cvs-commit at gcc dot gnu.org
@ 2021-11-25 13:29 ` hubicka at gcc dot gnu.org
  16 siblings, 0 replies; 18+ messages in thread
From: hubicka at gcc dot gnu.org @ 2021-11-25 13:29 UTC (permalink / raw)
  To: gcc-bugs

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

Jan Hubicka <hubicka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #16 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
Fixed on release branches too now.

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

end of thread, other threads:[~2021-11-25 13:29 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-02 21:45 [Bug c/103052] New: Function call omitted at -O1 optimization level tor at ccxvii dot net
2021-11-02 22:04 ` [Bug c/103052] " jakub at gcc dot gnu.org
2021-11-02 22:09 ` tor at ccxvii dot net
2021-11-02 22:15 ` [Bug middle-end/103052] " pinskia at gcc dot gnu.org
2021-11-02 22:16 ` [Bug middle-end/103052] [9/10/11/12 Regression] " pinskia at gcc dot gnu.org
2021-11-02 22:19 ` tor at ccxvii dot net
2021-11-02 22:39 ` [Bug ipa/103052] " pinskia at gcc dot gnu.org
2021-11-02 22:41 ` pinskia at gcc dot gnu.org
2021-11-03  8:31 ` [Bug ipa/103052] [9/10/11/12 Regression] Function is found to be pure looping but has a call to a noreturn function in it rguenth at gcc dot gnu.org
2021-11-03  8:35 ` marxin at gcc dot gnu.org
2021-11-03  8:44 ` hubicka at gcc dot gnu.org
2021-11-19 12:47 ` hubicka at gcc dot gnu.org
2021-11-20 23:35 ` cvs-commit at gcc dot gnu.org
2021-11-20 23:40 ` cvs-commit at gcc dot gnu.org
2021-11-25 11:25 ` [Bug ipa/103052] [9/10/11 " cvs-commit at gcc dot gnu.org
2021-11-25 11:29 ` cvs-commit at gcc dot gnu.org
2021-11-25 13:29 ` cvs-commit at gcc dot gnu.org
2021-11-25 13:29 ` hubicka 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).