public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug ipa/65873] [5/6 Regression] Failure to inline always_inline memcpy
  2015-04-24  9:55 [Bug ipa/65873] New: [5/6 Regression] Failure to inline always_inline memcpy jakub at gcc dot gnu.org
@ 2015-04-24  9:55 ` jakub at gcc dot gnu.org
  2015-04-24  9:56 ` jakub at gcc dot gnu.org
                   ` (13 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-04-24  9:55 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P1
   Target Milestone|---                         |5.2


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

* [Bug ipa/65873] New: [5/6 Regression] Failure to inline always_inline memcpy
@ 2015-04-24  9:55 jakub at gcc dot gnu.org
  2015-04-24  9:55 ` [Bug ipa/65873] " jakub at gcc dot gnu.org
                   ` (14 more replies)
  0 siblings, 15 replies; 16+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-04-24  9:55 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 65873
           Summary: [5/6 Regression] Failure to inline always_inline
                    memcpy
           Product: gcc
           Version: 5.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ipa
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jakub at gcc dot gnu.org

typedef __SIZE_TYPE__ size_t;

extern inline __attribute__ ((__always_inline__, __gnu_inline__,
__artificial__, __nothrow__, __leaf__)) void *
memcpy (void *__restrict __dest, const void *__restrict __src, size_t __len)
{
  return __builtin___memcpy_chk (__dest, __src, __len, __builtin_object_size
(__dest, 0));
}

__attribute__((optimize ("Ofast"))) void
bar (void *d, void *s, size_t l)
{
  memcpy (d, s, l);
}

fails to compile starting with r221706 (or r221707, neither of those versions
compile, r221704 works, r221710 fails).

This makes with -D_FORTIFY_SOURCE=2 all fortified functions unusable in
functions with explicit (non-default) optimize attribute.

As the always_inline function doesn't have a specific optimize attribute, I'd
say at least for always_inline functions it is undesirable to refuse to inline
them.  For target attribute, do we also refuse to inline, if say the whole CU
is compiled with -mavx2 and some function uses __attribute__((target ("sse2")))
and calls memcpy?


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

* [Bug ipa/65873] [5/6 Regression] Failure to inline always_inline memcpy
  2015-04-24  9:55 [Bug ipa/65873] New: [5/6 Regression] Failure to inline always_inline memcpy jakub at gcc dot gnu.org
  2015-04-24  9:55 ` [Bug ipa/65873] " jakub at gcc dot gnu.org
@ 2015-04-24  9:56 ` jakub at gcc dot gnu.org
  2015-04-27  8:05 ` hubicka at gcc dot gnu.org
                   ` (12 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-04-24  9:56 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-04-24
                 CC|                            |hubicka at gcc dot gnu.org
     Ever confirmed|0                           |1


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

* [Bug ipa/65873] [5/6 Regression] Failure to inline always_inline memcpy
  2015-04-24  9:55 [Bug ipa/65873] New: [5/6 Regression] Failure to inline always_inline memcpy jakub at gcc dot gnu.org
  2015-04-24  9:55 ` [Bug ipa/65873] " jakub at gcc dot gnu.org
  2015-04-24  9:56 ` jakub at gcc dot gnu.org
@ 2015-04-27  8:05 ` hubicka at gcc dot gnu.org
  2015-04-27  8:14 ` jakub at gcc dot gnu.org
                   ` (11 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: hubicka at gcc dot gnu.org @ 2015-04-27  8:05 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
The diff in flags is the following:

  not inlinable: bar/1 -> memcpy/0, optimization level attribute mismatch       

  align_functions (0/0x10)                                                      
  align_jumps (0/0x10)                                                          
  align_loops (0/0x10)                                                          
  flag_vect_cost_model (0x2/0x1)                                                
  optimize (0x3/0x2)                                                            
  flag_associative_math (0x1/0)                                                 
  flag_cx_limited_range (0x1/0)                                                 
  flag_finite_math_only (0x1/0)                                                 
  flag_gcse_after_reload (0x1/0)                                                
  flag_inline_functions (0x1/0)                                                 
  flag_ipa_cp_clone (0x1/0)                                                     
  flag_errno_math (0/0x1)                                                       
  flag_predictive_commoning (0x1/0)                                             
  flag_reciprocal_math (0x1/0)                                                  
  flag_signed_zeros (0/0x1)                                                     
  flag_trapping_math (0/0x1)                                                    
  flag_tree_loop_distribute_patterns (0x1/0)                                    
  flag_tree_loop_vectorize (0x1/0)                                              
  flag_tree_partial_pre (0x1/0)                                                 
  flag_tree_slp_vectorize (0x1/0)                                               
  flag_unsafe_math_optimizations (0x1/0)                                        
  flag_unswitch_loops (0x1/0)                                                   

so we fail because of errno-math difference.
The logic accepting/rejecitng inlines in can_inline_edge_p and I guess it is
the fact that we are affraid to inline safe math to unsafe.

I think certain combinations of flag will trigger ICE, such as one
enabling/disabling vector builtins. But I suppose we may want to bypass
majority of the checks for case we have always_inline w/o explicit optimization
attribute indeed, but only at early inlining time, probably not at LTO?
At LTO time we already did transformation that turn previously correct code
with target's optimization flags to be incorrect (i.e. -fstrict-aliasing blocks
some transformations we may do during early opts)


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

* [Bug ipa/65873] [5/6 Regression] Failure to inline always_inline memcpy
  2015-04-24  9:55 [Bug ipa/65873] New: [5/6 Regression] Failure to inline always_inline memcpy jakub at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2015-04-27  8:05 ` hubicka at gcc dot gnu.org
@ 2015-04-27  8:14 ` jakub at gcc dot gnu.org
  2015-04-27  9:19 ` rguenth at gcc dot gnu.org
                   ` (10 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-04-27  8:14 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Jan Hubicka from comment #1)
> I think certain combinations of flag will trigger ICE, such as one
> enabling/disabling vector builtins. But I suppose we may want to bypass
> majority of the checks for case we have always_inline w/o explicit
> optimization attribute indeed, but only at early inlining time, probably not
> at LTO?
> At LTO time we already did transformation that turn previously correct code
> with target's optimization flags to be incorrect (i.e. -fstrict-aliasing
> blocks some transformations we may do during early opts)

Yeah, special casing always_inline with no explicit optimize/target attributes
only, and only during early inlining IMHO should be sufficient.


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

* [Bug ipa/65873] [5/6 Regression] Failure to inline always_inline memcpy
  2015-04-24  9:55 [Bug ipa/65873] New: [5/6 Regression] Failure to inline always_inline memcpy jakub at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2015-04-27  8:14 ` jakub at gcc dot gnu.org
@ 2015-04-27  9:19 ` rguenth at gcc dot gnu.org
  2015-04-30 15:09 ` hubicka at gcc dot gnu.org
                   ` (9 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-04-27  9:19 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
I think simply honoring always_inline (the attribute! not just
DECL_DISREGARD_INLINE_LIMITS) regardless of any options would be ok as well
(and maybe simply reject optimize/target attributes on inline bodies?)


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

* [Bug ipa/65873] [5/6 Regression] Failure to inline always_inline memcpy
  2015-04-24  9:55 [Bug ipa/65873] New: [5/6 Regression] Failure to inline always_inline memcpy jakub at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2015-04-27  9:19 ` rguenth at gcc dot gnu.org
@ 2015-04-30 15:09 ` hubicka at gcc dot gnu.org
  2015-05-05  7:41 ` jakub at gcc dot gnu.org
                   ` (8 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: hubicka at gcc dot gnu.org @ 2015-04-30 15:09 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
Author: hubicka
Date: Thu Apr 30 15:09:19 2015
New Revision: 222634

URL: https://gcc.gnu.org/viewcvs?rev=222634&root=gcc&view=rev
Log:

        PR ipa/65873
        * ipa-inline.c (can_inline_edge_p): It is safe to inline across
        -fstrict-aliasing boundaries.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/ipa-inline.c


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

* [Bug ipa/65873] [5/6 Regression] Failure to inline always_inline memcpy
  2015-04-24  9:55 [Bug ipa/65873] New: [5/6 Regression] Failure to inline always_inline memcpy jakub at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2015-04-30 15:09 ` hubicka at gcc dot gnu.org
@ 2015-05-05  7:41 ` jakub at gcc dot gnu.org
  2015-05-13  0:09 ` hubicka at gcc dot gnu.org
                   ` (7 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-05-05  7:41 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Honza, any progress on this?


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

* [Bug ipa/65873] [5/6 Regression] Failure to inline always_inline memcpy
  2015-04-24  9:55 [Bug ipa/65873] New: [5/6 Regression] Failure to inline always_inline memcpy jakub at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2015-05-05  7:41 ` jakub at gcc dot gnu.org
@ 2015-05-13  0:09 ` hubicka at gcc dot gnu.org
  2015-05-13  2:55 ` hubicka at gcc dot gnu.org
                   ` (6 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: hubicka at gcc dot gnu.org @ 2015-05-13  0:09 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
Patch posted https://gcc.gnu.org/ml/gcc-patches/2015-05/msg01167.html


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

* [Bug ipa/65873] [5/6 Regression] Failure to inline always_inline memcpy
  2015-04-24  9:55 [Bug ipa/65873] New: [5/6 Regression] Failure to inline always_inline memcpy jakub at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2015-05-13  0:09 ` hubicka at gcc dot gnu.org
@ 2015-05-13  2:55 ` hubicka at gcc dot gnu.org
  2015-05-13  2:58 ` hubicka at gcc dot gnu.org
                   ` (5 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: hubicka at gcc dot gnu.org @ 2015-05-13  2:55 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
Author: hubicka
Date: Wed May 13 02:54:50 2015
New Revision: 223107

URL: https://gcc.gnu.org/viewcvs?rev=223107&root=gcc&view=rev
Log:

        PR ipa/65873
        * ipa-inline.c (can_inline_edge_p): Allow early inlining of always
        inlines across optimization boundary.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/ipa-inline.c


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

* [Bug ipa/65873] [5/6 Regression] Failure to inline always_inline memcpy
  2015-04-24  9:55 [Bug ipa/65873] New: [5/6 Regression] Failure to inline always_inline memcpy jakub at gcc dot gnu.org
                   ` (8 preceding siblings ...)
  2015-05-13  2:55 ` hubicka at gcc dot gnu.org
@ 2015-05-13  2:58 ` hubicka at gcc dot gnu.org
  2015-05-13 15:51 ` [Bug ipa/65873] [5 " hubicka at gcc dot gnu.org
                   ` (4 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: hubicka at gcc dot gnu.org @ 2015-05-13  2:58 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
Author: hubicka
Date: Wed May 13 02:57:27 2015
New Revision: 223108

URL: https://gcc.gnu.org/viewcvs?rev=223108&root=gcc&view=rev
Log:

        PR ipa/65873
        * ipa-inline.c (can_inline_edge_p): Allow early inlining of always
        inlines across optimization boundary.
        * testsuite/gcc.c-torture/compile/pr65873.c: New testcase.

Added:
    trunk/gcc/testsuite/gcc.c-torture/compile/pr65873.c
Modified:
    trunk/gcc/testsuite/ChangeLog


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

* [Bug ipa/65873] [5 Regression] Failure to inline always_inline memcpy
  2015-04-24  9:55 [Bug ipa/65873] New: [5/6 Regression] Failure to inline always_inline memcpy jakub at gcc dot gnu.org
                   ` (9 preceding siblings ...)
  2015-05-13  2:58 ` hubicka at gcc dot gnu.org
@ 2015-05-13 15:51 ` hubicka at gcc dot gnu.org
  2015-05-17 17:43 ` hubicka at gcc dot gnu.org
                   ` (3 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: hubicka at gcc dot gnu.org @ 2015-05-13 15:51 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[5/6 Regression] Failure to |[5 Regression] Failure to
                   |inline always_inline memcpy |inline always_inline memcpy

--- Comment #9 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
With the workaround it is no longer 6 regression, still an ugly bug.


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

* [Bug ipa/65873] [5 Regression] Failure to inline always_inline memcpy
  2015-04-24  9:55 [Bug ipa/65873] New: [5/6 Regression] Failure to inline always_inline memcpy jakub at gcc dot gnu.org
                   ` (10 preceding siblings ...)
  2015-05-13 15:51 ` [Bug ipa/65873] [5 " hubicka at gcc dot gnu.org
@ 2015-05-17 17:43 ` hubicka at gcc dot gnu.org
  2015-05-23 19:38 ` [Bug ipa/65873] " hubicka at gcc dot gnu.org
                   ` (2 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: hubicka at gcc dot gnu.org @ 2015-05-17 17:43 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #10 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
Author: hubicka
Date: Sun May 17 17:43:04 2015
New Revision: 223270

URL: https://gcc.gnu.org/viewcvs?rev=223270&root=gcc&view=rev
Log:

        PR ipa/65873
        * ipa-inline.c (can_inline_edge_p): Allow early inlining of always
        inlines across optimization boundary; be tolerant about COMDAT;
        allow inlining across -fstrict-aliasing boundary.

Modified:
    branches/gcc-5-branch/gcc/ChangeLog
    branches/gcc-5-branch/gcc/ipa-inline.c


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

* [Bug ipa/65873] Failure to inline always_inline memcpy
  2015-04-24  9:55 [Bug ipa/65873] New: [5/6 Regression] Failure to inline always_inline memcpy jakub at gcc dot gnu.org
                   ` (11 preceding siblings ...)
  2015-05-17 17:43 ` hubicka at gcc dot gnu.org
@ 2015-05-23 19:38 ` hubicka at gcc dot gnu.org
  2015-07-16  9:17 ` rguenth at gcc dot gnu.org
  2022-01-09  0:44 ` pinskia at gcc dot gnu.org
  14 siblings, 0 replies; 16+ messages in thread
From: hubicka at gcc dot gnu.org @ 2015-05-23 19:38 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[5 Regression] Failure to   |Failure to inline
                   |inline always_inline memcpy |always_inline memcpy

--- Comment #11 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
Workaround backported to GCC 5.


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

* [Bug ipa/65873] Failure to inline always_inline memcpy
  2015-04-24  9:55 [Bug ipa/65873] New: [5/6 Regression] Failure to inline always_inline memcpy jakub at gcc dot gnu.org
                   ` (12 preceding siblings ...)
  2015-05-23 19:38 ` [Bug ipa/65873] " hubicka at gcc dot gnu.org
@ 2015-07-16  9:17 ` rguenth at gcc dot gnu.org
  2022-01-09  0:44 ` pinskia at gcc dot gnu.org
  14 siblings, 0 replies; 16+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-07-16  9:17 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|5.2                         |5.3

--- Comment #12 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 5.2 is being released, adjusting target milestone to 5.3.


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

* [Bug ipa/65873] Failure to inline always_inline memcpy
  2015-04-24  9:55 [Bug ipa/65873] New: [5/6 Regression] Failure to inline always_inline memcpy jakub at gcc dot gnu.org
                   ` (13 preceding siblings ...)
  2015-07-16  9:17 ` rguenth at gcc dot gnu.org
@ 2022-01-09  0:44 ` pinskia at gcc dot gnu.org
  14 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-01-09  0:44 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|5.5                         |---

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

end of thread, other threads:[~2022-01-09  0:44 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-24  9:55 [Bug ipa/65873] New: [5/6 Regression] Failure to inline always_inline memcpy jakub at gcc dot gnu.org
2015-04-24  9:55 ` [Bug ipa/65873] " jakub at gcc dot gnu.org
2015-04-24  9:56 ` jakub at gcc dot gnu.org
2015-04-27  8:05 ` hubicka at gcc dot gnu.org
2015-04-27  8:14 ` jakub at gcc dot gnu.org
2015-04-27  9:19 ` rguenth at gcc dot gnu.org
2015-04-30 15:09 ` hubicka at gcc dot gnu.org
2015-05-05  7:41 ` jakub at gcc dot gnu.org
2015-05-13  0:09 ` hubicka at gcc dot gnu.org
2015-05-13  2:55 ` hubicka at gcc dot gnu.org
2015-05-13  2:58 ` hubicka at gcc dot gnu.org
2015-05-13 15:51 ` [Bug ipa/65873] [5 " hubicka at gcc dot gnu.org
2015-05-17 17:43 ` hubicka at gcc dot gnu.org
2015-05-23 19:38 ` [Bug ipa/65873] " hubicka at gcc dot gnu.org
2015-07-16  9:17 ` rguenth at gcc dot gnu.org
2022-01-09  0:44 ` pinskia 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).