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

--- Comment #5 from Martin Liška <marxin at gcc dot gnu.org> ---
So the GNU TM is involved only very slightly as it prevents one inlining
candidate:

Without -fgnu-tm:

Enqueueing calls in d::~d()/9.
   Estimating body: c.constprop/34
   Known to be false: not inlined
   size:0 time:0.000000 nonspec time:2.000000
   Estimating body: c.constprop/34
   Known to be false: not inlined
   size:0 time:0.000000 nonspec time:2.000000
  enqueuing call d::~d()/9 -> c.constprop/34, badness -inf

With -fgnu-tm:
pr47218.ii:14:25: missed:   not inlinable: d::~d()/9 -> c.constprop/34,

reason is this:
ipa-inline.c:364:

  /* TM pure functions should not be inlined into non-TM_pure
     functions.  */
  else if (is_tm_pure (callee->decl) && !is_tm_pure (caller->decl))
    {
      e->inline_failed = CIF_UNSPECIFIED;
      inlinable = false;
    }

The following patch can cause the ICE without -fgnu-tm:

diff --git a/gcc/ipa-inline.c b/gcc/ipa-inline.c
index f71443feff7..cb968059a28 100644
--- a/gcc/ipa-inline.c
+++ b/gcc/ipa-inline.c
@@ -361,7 +361,8 @@ can_inline_edge_p (struct cgraph_edge *e, bool report,
     }
   /* TM pure functions should not be inlined into non-TM_pure
      functions.  */
-  else if (is_tm_pure (callee->decl) && !is_tm_pure (caller->decl))
+  else if (strcmp (callee->name(), "c.constprop") == 0
+          && strcmp (caller->name(), "d::~d()") == 0)
     {
       e->inline_failed = CIF_UNSPECIFIED;
       inlinable = false;

@Martin, Honza: Can you please take a look?
I tend to mark it as P1.

Reply via email to