public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug ipa/103636] New: Clang build fails with -flto -fno-strict-aliaisng -flifetime-dse=1 -fprofile-generate
@ 2021-12-09 19:24 hubicka at gcc dot gnu.org
  2021-12-09 19:27 ` [Bug ipa/103636] " hubicka at gcc dot gnu.org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: hubicka at gcc dot gnu.org @ 2021-12-09 19:24 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 103636
           Summary: Clang build fails with -flto -fno-strict-aliaisng
                    -flifetime-dse=1 -fprofile-generate
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ipa
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hubicka at gcc dot gnu.org
                CC: marxin at gcc dot gnu.org
  Target Milestone: ---

Buid fails with:
during IPA pass: inline
lto1: internal compiler error: Segmentation fault
0x9ed401 crash_signal
        ../../gcc/toplev.c:322
0x4ec993 can_inline_edge_p
        ../../gcc/ipa-inline.c:409
0x12f3be4 inline_small_functions
        ../../gcc/ipa-inline.c:2036
0x12f3be4 ipa_inline
        ../../gcc/ipa-inline.c:2743
0x12f3be4 execute
        ../../gcc/ipa-inline.c:3142

the failure is:
aad72d2ea837 (Martin Liska           2021-06-22 10:09:01 +0200  399)   else if
(profile_arc_flag
aad72d2ea837 (Martin Liska           2021-06-22 10:09:01 +0200  400)       &&
(lookup_attribute ("no_profile_instrument_function",
aad72d2ea837 (Martin Liska           2021-06-22 10:09:01 +0200  401)           
                 DECL_ATTRIBUTES (caller->decl)) == NULL_TREE)
aad72d2ea837 (Martin Liska           2021-06-22 10:09:01 +0200  402)       !=
(lookup_attribute ("no_profile_instrument_function",
aad72d2ea837 (Martin Liska           2021-06-22 10:09:01 +0200  403)           
                 DECL_ATTRIBUTES (callee->decl)) == NULL_TREE))
aad72d2ea837 (Martin Liska           2021-06-22 10:09:01 +0200  404)     {
aad72d2ea837 (Martin Liska           2021-06-22 10:09:01 +0200  405)      
cgraph_node *origin = caller;
aad72d2ea837 (Martin Liska           2021-06-22 10:09:01 +0200  406)      
while (origin->clone_of)
aad72d2ea837 (Martin Liska           2021-06-22 10:09:01 +0200  407)    origin
= origin->clone_of;
aad72d2ea837 (Martin Liska           2021-06-22 10:09:01 +0200  408)
aad72d2ea837 (Martin Liska           2021-06-22 10:09:01 +0200  409)       if
(!DECL_STRUCT_FUNCTION (origin->decl)->always_inline_functions_inlined)
aad72d2ea837 (Martin Liska           2021-06-22 10:09:01 +0200  410)    {
aad72d2ea837 (Martin Liska           2021-06-22 10:09:01 +0200  411)     
e->inline_failed = CIF_UNSPECIFIED;
aad72d2ea837 (Martin Liska           2021-06-22 10:09:01 +0200  412)     
inlinable = false;
aad72d2ea837 (Martin Liska           2021-06-22 10:09:01 +0200  413)    }
aad72d2ea837 (Martin Liska           2021-06-22 10:09:01 +0200  414)     }
aad72d2ea837 (Martin Liska           2021-06-22 10:09:01 +0200  415)
9a4841a37014 (Jan Hubicka            2018-01-30 14:23:39 +0100  416)   if
(!inlinable && report)
9a4841a37014 (Jan Hubicka            2018-01-30 14:23:39 +0100  417)    
report_inline_failed_reason (e);
9a4841a37014 (Jan Hubicka            2018-01-30 14:23:39 +0100  418)   return
inlinable;

one can not access DECL_STRUCT_FUNCTION in WPA.   g:aad72d2ea837 speaks about
einline, so why it is not tested in can_early_inline_edge_p?

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

* [Bug ipa/103636] Clang build fails with -flto -fno-strict-aliaisng -flifetime-dse=1 -fprofile-generate
  2021-12-09 19:24 [Bug ipa/103636] New: Clang build fails with -flto -fno-strict-aliaisng -flifetime-dse=1 -fprofile-generate hubicka at gcc dot gnu.org
@ 2021-12-09 19:27 ` hubicka at gcc dot gnu.org
  2021-12-09 19:34 ` marxin at gcc dot gnu.org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: hubicka at gcc dot gnu.org @ 2021-12-09 19:27 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
I found the email here
http://patches-tcwg.linaro.org/patch/56399/
I have suggested moving the check to einline only path but the v2 version of
patch did not implemented it and later it got in with the additional loop
walking clones.  Is there any reason to prevent inlining post-instrumentation?
If not, I think we want to remove the loop and move the check into
can_early_inline_edge_p as suggested originally.

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

* [Bug ipa/103636] Clang build fails with -flto -fno-strict-aliaisng -flifetime-dse=1 -fprofile-generate
  2021-12-09 19:24 [Bug ipa/103636] New: Clang build fails with -flto -fno-strict-aliaisng -flifetime-dse=1 -fprofile-generate hubicka at gcc dot gnu.org
  2021-12-09 19:27 ` [Bug ipa/103636] " hubicka at gcc dot gnu.org
@ 2021-12-09 19:34 ` marxin at gcc dot gnu.org
  2021-12-09 19:37 ` marxin at gcc dot gnu.org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-12-09 19:34 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---
(In reply to Jan Hubicka from comment #1)
> I found the email here
> http://patches-tcwg.linaro.org/patch/56399/
> I have suggested moving the check to einline only path but the v2 version of
> patch did not implemented it and later it got in with the additional loop
> walking clones.  Is there any reason to prevent inlining
> post-instrumentation?

Oh, I likely installed the wrong version of the patch because I remember I
wrote the patch..

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

* [Bug ipa/103636] Clang build fails with -flto -fno-strict-aliaisng -flifetime-dse=1 -fprofile-generate
  2021-12-09 19:24 [Bug ipa/103636] New: Clang build fails with -flto -fno-strict-aliaisng -flifetime-dse=1 -fprofile-generate hubicka at gcc dot gnu.org
  2021-12-09 19:27 ` [Bug ipa/103636] " hubicka at gcc dot gnu.org
  2021-12-09 19:34 ` marxin at gcc dot gnu.org
@ 2021-12-09 19:37 ` marxin at gcc dot gnu.org
  2021-12-09 19:49 ` hubicka at gcc dot gnu.org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-12-09 19:37 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |marxin at gcc dot gnu.org
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2021-12-09

--- Comment #3 from Martin Liška <marxin at gcc dot gnu.org> ---
So a correct version was installed where I thought that DECL_STRUCT_FUNCTION
(origin->decl)->always_inline_functions_inlined is the right check for function
being before or after einline. Lemme fix that.

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

* [Bug ipa/103636] Clang build fails with -flto -fno-strict-aliaisng -flifetime-dse=1 -fprofile-generate
  2021-12-09 19:24 [Bug ipa/103636] New: Clang build fails with -flto -fno-strict-aliaisng -flifetime-dse=1 -fprofile-generate hubicka at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2021-12-09 19:37 ` marxin at gcc dot gnu.org
@ 2021-12-09 19:49 ` hubicka at gcc dot gnu.org
  2021-12-10  0:31 ` [Bug ipa/103636] [12 Regression] " pinskia at gcc dot gnu.org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: hubicka at gcc dot gnu.org @ 2021-12-09 19:49 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
aha, it was missunderstanding then :)
I wanted you to simply move the hunk to can_early_inline_edge_p.  There is no
specific bit to check for einline being finished.

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

* [Bug ipa/103636] [12 Regression] Clang build fails with -flto -fno-strict-aliaisng -flifetime-dse=1 -fprofile-generate
  2021-12-09 19:24 [Bug ipa/103636] New: Clang build fails with -flto -fno-strict-aliaisng -flifetime-dse=1 -fprofile-generate hubicka at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2021-12-09 19:49 ` hubicka at gcc dot gnu.org
@ 2021-12-10  0:31 ` pinskia at gcc dot gnu.org
  2021-12-10 10:24 ` marxin at gcc dot gnu.org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-10  0:31 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-valid-code
   Target Milestone|---                         |12.0
            Summary|Clang build fails with      |[12 Regression] Clang build
                   |-flto -fno-strict-aliaisng  |fails with -flto
                   |-flifetime-dse=1            |-fno-strict-aliaisng
                   |-fprofile-generate          |-flifetime-dse=1
                   |                            |-fprofile-generate

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

* [Bug ipa/103636] [12 Regression] Clang build fails with -flto -fno-strict-aliaisng -flifetime-dse=1 -fprofile-generate
  2021-12-09 19:24 [Bug ipa/103636] New: Clang build fails with -flto -fno-strict-aliaisng -flifetime-dse=1 -fprofile-generate hubicka at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2021-12-10  0:31 ` [Bug ipa/103636] [12 Regression] " pinskia at gcc dot gnu.org
@ 2021-12-10 10:24 ` marxin at gcc dot gnu.org
  2021-12-10 10:28 ` marxin at gcc dot gnu.org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-12-10 10:24 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Martin Liška <marxin at gcc dot gnu.org> ---
Btw. how do you inject the CXXLFAGS to LLVM's cmake?

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

* [Bug ipa/103636] [12 Regression] Clang build fails with -flto -fno-strict-aliaisng -flifetime-dse=1 -fprofile-generate
  2021-12-09 19:24 [Bug ipa/103636] New: Clang build fails with -flto -fno-strict-aliaisng -flifetime-dse=1 -fprofile-generate hubicka at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2021-12-10 10:24 ` marxin at gcc dot gnu.org
@ 2021-12-10 10:28 ` marxin at gcc dot gnu.org
  2021-12-10 10:36 ` hubicka at kam dot mff.cuni.cz
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-12-10 10:28 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Martin Liška <marxin at gcc dot gnu.org> ---
Got it, explained here:
https://llvm.org/docs/CMake.html#frequently-used-cmake-variables

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

* [Bug ipa/103636] [12 Regression] Clang build fails with -flto -fno-strict-aliaisng -flifetime-dse=1 -fprofile-generate
  2021-12-09 19:24 [Bug ipa/103636] New: Clang build fails with -flto -fno-strict-aliaisng -flifetime-dse=1 -fprofile-generate hubicka at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2021-12-10 10:28 ` marxin at gcc dot gnu.org
@ 2021-12-10 10:36 ` hubicka at kam dot mff.cuni.cz
  2021-12-13 13:58 ` cvs-commit at gcc dot gnu.org
  2021-12-13 13:59 ` marxin at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: hubicka at kam dot mff.cuni.cz @ 2021-12-10 10:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from hubicka at kam dot mff.cuni.cz ---
I use
cmake -G "Unix Makefiles" /home/jh/llvm-project/llvm
-DCLANG_TABLEGEN=/home/jh/llvm-project/llvm/out/stage1/bin/clang-tblgen
-DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=/home/jh/trunk-install/bin/g++
-DCMAKE_C_COMPILER=/home/jh/trunk-install/bin/gcc -DLL
VM_BINUTILS_INCDIR=/home/jh/binutils-install/include/ -DLLVM_BUILD_RUNTIME=No
-DLLVM_ENABLE_PROJECTS="clang;compiler-rt;lld" -DLL
VM_TABLEGEN=/home/jh/llvm-project/llvm/out/stage1/bin/llvm-tblgen
-DLLVM_TARGETS_TO_BUILD=X86 -DCMAKE_C_FLAGS_RELEASE="-O2 -fno-s trict-aliasing 
-flifetime-dse=1 -flto=auto -fno-semantic-interposition -fprofile-generate
-DNDEBUG" -DCMAKE_CXX_FLAGS_RELEASE="- O2  -flto=auto  -fno-strict-aliasing
-flifetime-dse=1 -fno-semantic-interposition -fprofile-generate -DNDEBUG"

I already checked that with that hunk in can_inline_edge_p commented out
the clang build and training run works.
Sadly clang segfaults with either strict aliasing or lifetime-dse
enabled.

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

* [Bug ipa/103636] [12 Regression] Clang build fails with -flto -fno-strict-aliaisng -flifetime-dse=1 -fprofile-generate
  2021-12-09 19:24 [Bug ipa/103636] New: Clang build fails with -flto -fno-strict-aliaisng -flifetime-dse=1 -fprofile-generate hubicka at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2021-12-10 10:36 ` hubicka at kam dot mff.cuni.cz
@ 2021-12-13 13:58 ` cvs-commit at gcc dot gnu.org
  2021-12-13 13:59 ` marxin at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-12-13 13:58 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Martin Liska <marxin@gcc.gnu.org>:

https://gcc.gnu.org/g:9eb8785b3fa3a180bd216cf68b53f1621628efc6

commit r12-5931-g9eb8785b3fa3a180bd216cf68b53f1621628efc6
Author: Martin Liska <mliska@suse.cz>
Date:   Fri Dec 10 11:40:54 2021 +0100

    inline: fix ICE with -fprofile-generate

            PR ipa/103636

    gcc/ChangeLog:

            * ipa-inline.c (can_inline_edge_p): Move logic checking
            no_profile_instrument_function logic to ...
            (can_early_inline_edge_p): ... here.

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

* [Bug ipa/103636] [12 Regression] Clang build fails with -flto -fno-strict-aliaisng -flifetime-dse=1 -fprofile-generate
  2021-12-09 19:24 [Bug ipa/103636] New: Clang build fails with -flto -fno-strict-aliaisng -flifetime-dse=1 -fprofile-generate hubicka at gcc dot gnu.org
                   ` (8 preceding siblings ...)
  2021-12-13 13:58 ` cvs-commit at gcc dot gnu.org
@ 2021-12-13 13:59 ` marxin at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-12-13 13:59 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

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

--- Comment #9 from Martin Liška <marxin at gcc dot gnu.org> ---
Fixed.

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

end of thread, other threads:[~2021-12-13 13:59 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-09 19:24 [Bug ipa/103636] New: Clang build fails with -flto -fno-strict-aliaisng -flifetime-dse=1 -fprofile-generate hubicka at gcc dot gnu.org
2021-12-09 19:27 ` [Bug ipa/103636] " hubicka at gcc dot gnu.org
2021-12-09 19:34 ` marxin at gcc dot gnu.org
2021-12-09 19:37 ` marxin at gcc dot gnu.org
2021-12-09 19:49 ` hubicka at gcc dot gnu.org
2021-12-10  0:31 ` [Bug ipa/103636] [12 Regression] " pinskia at gcc dot gnu.org
2021-12-10 10:24 ` marxin at gcc dot gnu.org
2021-12-10 10:28 ` marxin at gcc dot gnu.org
2021-12-10 10:36 ` hubicka at kam dot mff.cuni.cz
2021-12-13 13:58 ` cvs-commit at gcc dot gnu.org
2021-12-13 13:59 ` marxin 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).