Patchwork [trans-mem] PR/45985: set frequency for irrevocable calls

login
register
mail settings
Submitter Aldy Hernandez
Date Nov. 3, 2010, 4:16 p.m.
Message ID <20101103161612.GA14423@redhat.com>
Download mbox | patch
Permalink /patch/70036/
State New
Headers show

Comments

Aldy Hernandez - Nov. 3, 2010, 4:16 p.m.
A while ago, a merge into the trans-mem branch brought some changes to
verify_cgraph_node() to verify that the callee and callers on an edge
had the same frequency.  As part of that merge, I found that the edge
created for TM_GETTMCLONE calls did not have the frequency set
(see ipa_tm_insert_gettmclone_call).

This PR found another call to cgraph_create_edge() without frequency
information, which is causing the verify_cgraph_node() to fail.  I
should have checked all calls to cgraph_create_edge() at merge time.
Luckily, this is the only remaining call.

OK for branch?

Back on the saddle.
Aldy

p.s. The curious reader may note that rth has been 


	PR/45985
	* trans-mem.c (ipa_tm_insert_irr_call): Pass frequency to
	cgraph_create_edge.
Richard Henderson - Nov. 3, 2010, 4:21 p.m.
On 11/03/2010 09:16 AM, Aldy Hernandez wrote:
> 	PR/45985
> 	* trans-mem.c (ipa_tm_insert_irr_call): Pass frequency to
> 	cgraph_create_edge.

Ok.


r~

Patch

Index: testsuite/gcc.dg/tm/pr45985.c
===================================================================
--- testsuite/gcc.dg/tm/pr45985.c	(revision 0)
+++ testsuite/gcc.dg/tm/pr45985.c	(revision 0)
@@ -0,0 +1,14 @@ 
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm" } */
+
+__attribute__((transaction_unsafe))
+void illegal();
+
+static int a = 0;
+void func()
+{
+  __transaction [[relaxed]] {
+    if( a == 0)
+      illegal();
+  }
+}
Index: trans-mem.c
===================================================================
--- trans-mem.c	(revision 166180)
+++ trans-mem.c	(working copy)
@@ -4021,7 +4021,10 @@  ipa_tm_insert_irr_call (struct cgraph_no
 
   cgraph_create_edge (node,
 		      cgraph_node (built_in_decls[BUILT_IN_TM_IRREVOCABLE]),
-		      g, 0, 0, bb->loop_depth);
+		      g, 0,
+		      compute_call_stmt_bb_frequency (node->decl,
+						      gimple_bb (g)),
+		      bb->loop_depth);
 }
 
 /* Construct a call to TM_GETTMCLONE and insert it before GSI.  */