Message ID | 20171119200618.GF60547@kam.mff.cuni.cz |
---|---|
State | New |
Headers | show |
Series | Fix PR81360 | expand |
On Sun, Nov 19, 2017 at 09:06:19PM +0100, Jan Hubicka wrote: > Hi, > this testcase triggers ICE because we try to inline into -O0 function. > Fixed thus. > > Bootstrapped/regtested x86_64-linux, comitted. > > Honza > > * gcc.c-torture/compile/pr81360.c: New testcase. > * ipa-inline.c (can_inline_edge_p): Also check that caller is optimized I believe this caused hundreds of new FAILs on both x86_64 and i686-linux. Seems after this change we no longer inline always_inline functions into -O0 callers, which is wrong. Jakub
> I believe this caused hundreds of new FAILs on both x86_64 and i686-linux. > Seems after this change we no longer inline always_inline functions into > -O0 callers, which is wrong. That's worse than this, inlining is totally broken...
> > I believe this caused hundreds of new FAILs on both x86_64 and i686-linux. > > Seems after this change we no longer inline always_inline functions into > > -O0 callers, which is wrong. > > That's worse than this, inlining is totally broken... It was a typo in the conditional (I cleaned it up just before comitting because I noticed I can merge it with earlier conditional and accidentally dropped !). It should be fixed now. Honza > > -- > Eric Botcazou
> It was a typo in the conditional (I cleaned it up just before comitting > because I noticed I can merge it with earlier conditional and accidentally > dropped !). It should be fixed now. OK, thanks, unfortunately the bug made it into the latest source snapshot.
Index: testsuite/gcc.c-torture/compile/pr81360.c =================================================================== --- testsuite/gcc.c-torture/compile/pr81360.c (revision 0) +++ testsuite/gcc.c-torture/compile/pr81360.c (working copy) @@ -0,0 +1,11 @@ +typedef a; +b(void *c, a d) { + if (c) + e(0, __PRETTY_FUNCTION__); +} +typedef f, g; +__attribute__((optimize(0))) h() { + g i; + b(i, sizeof(f)); +} + Index: ipa-inline.c =================================================================== --- ipa-inline.c (revision 254929) +++ ipa-inline.c (working copy) @@ -324,7 +324,8 @@ can_inline_edge_p (struct cgraph_edge *e e->inline_failed = CIF_BODY_NOT_AVAILABLE; inlinable = false; } - if (!early && !opt_for_fn (callee->decl, optimize)) + if (!early && (!opt_for_fn (callee->decl, optimize) + || opt_for_fn (caller->decl, optimize))) { e->inline_failed = CIF_FUNCTION_NOT_OPTIMIZED; inlinable = false;