This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[trans-mem] mark cgraph nodes as used for TM clones


I'm trying to get the "intset" TM benchmark working with GCC, and I've
found a handful of problems.

In one horribly large testcase there are a cascade of inline functions,
one of which does not get inlined but instead is transformed into a
GETTMCLONE built-in.  However, during IPA inling later we think the
function is unused (in function_and_variable_visibility()) because
cgraph_only_called_directly_p() returns true since node->needed is
false.

Since we're technically taking the address of the original function to
be tm-cloned, it is best to explain that we've taken its address and
consecuently mark the node as needed.  

This approach fixes the ICE, which I've yet to narrow down to a small
testcase.  I doubt I can use the big testcase, since the authors haven't
signed FSF paperwork.

OK for branch?

	* trans-mem.c (ipa_tm_insert_gettmclone_call): Mark the old
	cgraph node as used.

Index: trans-mem.c
===================================================================
--- trans-mem.c	(revision 157626)
+++ trans-mem.c	(working copy)
@@ -3849,6 +3849,15 @@ ipa_tm_insert_gettmclone_call (struct cg
 
   old_fn = gimple_call_fn (stmt);
 
+  if (TREE_CODE (old_fn) == ADDR_EXPR)
+    {
+      tree fndecl = TREE_OPERAND (old_fn, 0);
+      /* We're technically taking the address of the original function
+	 by transforming the call into a TM_GETTMCLONE.  Explain this
+	 so inlining will know this function is needed.  */
+      cgraph_mark_address_taken_node (cgraph_node (fndecl));
+    }
+
   safe = is_tm_safe (TREE_TYPE (old_fn));
   gettm_fn = built_in_decls[safe ? BUILT_IN_TM_GETTMCLONE_SAFE
 			    : BUILT_IN_TM_GETTMCLONE_IRR];


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]