===================================================================
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm" } */
+
+int george;
+
+__attribute__((transaction_callable))
+void q1()
+{
+ __transaction [[atomic]] {
+ george=999;
+ }
+ q1();
+}
+
+/* { dg-final { scan-assembler-not "_ITM_getTMCloneOrIrrevocable" } } */
===================================================================
@@ -4294,8 +4294,14 @@ ipa_tm_transform_calls_redirect (struct
struct cgraph_edge *e = cgraph_edge (node, stmt);
tree fndecl = gimple_call_fndecl (stmt);
+ /* No need to go through _ITM_getTMCloneOrIrrevocable. We can just
+ call the clone directly if we know it. */
+ if (DECL_IS_TM_CLONE (e->callee->decl))
+ fndecl = e->callee->decl;
+ else
+ fndecl = find_tm_replacement_function (fndecl);
+
/* If there is a replacement, use it, otherwise use the clone. */
- fndecl = find_tm_replacement_function (fndecl);
if (fndecl)
{
new_node = cgraph_node (fndecl);