Index: tree-inline.c
===================================================================
--- tree-inline.c	(revision 168743)
+++ tree-inline.c	(working copy)
@@ -5100,6 +5100,17 @@ tree_can_inline_p (struct cgraph_edge *e
       return false;
     }
 
+  /* TM pure functions should not get inlined if the outer function is
+     a TM safe function.  */
+  if (flag_tm
+      && is_tm_pure (callee)
+      && is_tm_safe (caller))
+    {
+      e->inline_failed = CIF_UNSPECIFIED;
+      gimple_call_set_cannot_inline (e->call_stmt, true);
+      return false;
+    }
+
   /* Allow the backend to decide if inlining is ok.  */
   if (!targetm.target_option.can_inline_p (caller, callee))
     {
Index: integrate.c
===================================================================
--- integrate.c	(revision 168743)
+++ integrate.c	(working copy)
@@ -72,15 +72,6 @@ static void set_block_abstract_flags (tr
 bool
 function_attribute_inlinable_p (const_tree fndecl)
 {
-  /* TM pure functions should not get inlined if the outer function is
-     a TM safe function.
-
-     FIXME: In the meantime, prevent pure functions from being
-     inlined.  */
-  if (flag_tm
-      && is_tm_pure (fndecl))
-    return false;
-
   if (targetm.attribute_table)
     {
       const_tree a;
