Patchwork [trans-mem] Fix tm_pure not inlinable in tm_safe

login
register
mail settings
Submitter Patrick Marlier
Date Oct. 31, 2011, 6:54 p.m.
Message ID <4EAEEEF0.3020006@gmail.com>
Download mbox | patch
Permalink /patch/122920/
State New
Headers show

Comments

Patrick Marlier - Oct. 31, 2011, 6:54 p.m.
This fixes the g++ pr45940-4 failure. I think it is due to the latest merge.

Tested on i686. (I cannot test it yet on x86-64, I hope to get access to 
a 64 bit soon...)

Patrick.

2011-10-31  Patrick Marlier  <patrick.marlier@gmail.com>
         * ipa-inline.c: Adjust how cannot_inline is set.
Aldy Hernandez - Oct. 31, 2011, 7:21 p.m.
On 10/31/11 13:54, Patrick Marlier wrote:
> This fixes the g++ pr45940-4 failure. I think it is due to the latest
> merge.
>
> Tested on i686. (I cannot test it yet on x86-64, I hope to get access to
> a 64 bit soon...)
>
> Patrick.
>
> 2011-10-31 Patrick Marlier <patrick.marlier@gmail.com>
> * ipa-inline.c: Adjust how cannot_inline is set.
>

Heh, funny... I have the exact same patch on this end.  But it doesn't 
completely fix the pr45940-4, cause now I get a segfault here:

	  if (is_gimple_call (stmt))
	    {
	      struct cgraph_edge *edge = cgraph_edge (node, stmt);
	      struct inline_edge_summary *es = inline_edge_summary (edge);

	      /* Special case: results of BUILT_IN_CONSTANT_P will be always
		 resolved as constant.  We however don't want to optimize
		 out the cgraph edges.  */

The edge isn't set.  I don't know if this is related or not.  I'm 
investigating.

BTW, are you sure it fixes the regression?  I still get this other 
segfault on both x86-32 and x86-64.
Patrick Marlier - Oct. 31, 2011, 7:33 p.m.
On 10/31/2011 03:21 PM, Aldy Hernandez wrote:
> On 10/31/11 13:54, Patrick Marlier wrote:
>> This fixes the g++ pr45940-4 failure. I think it is due to the latest
>> merge.
>>
>> Tested on i686. (I cannot test it yet on x86-64, I hope to get access to
>> a 64 bit soon...)
>>
>> Patrick.
>>
>> 2011-10-31 Patrick Marlier <patrick.marlier@gmail.com>
>> * ipa-inline.c: Adjust how cannot_inline is set.
>>
>
> Heh, funny... I have the exact same patch on this end. But it doesn't
> completely fix the pr45940-4, cause now I get a segfault here:
>
> if (is_gimple_call (stmt))
> {
> struct cgraph_edge *edge = cgraph_edge (node, stmt);
> struct inline_edge_summary *es = inline_edge_summary (edge);
>
> /* Special case: results of BUILT_IN_CONSTANT_P will be always
> resolved as constant. We however don't want to optimize
> out the cgraph edges. */
>
> The edge isn't set. I don't know if this is related or not. I'm
> investigating.
>
> BTW, are you sure it fixes the regression? I still get this other
> segfault on both x86-32 and x86-64.

It does on my side:

                 === g++ Summary ===
# of expected passes            122

I have no other change over the source.

Patrick.


Copy/Paste if I run the command line directly in the terminal:

marlier@d01:/localdisk/gcc/tm-build-dbg$ 
/localdisk/gcc/tm-build-dbg/gcc/testsuite/g++/../../g++ 
-B/localdisk/gcc/tm-build-dbg/gcc/testsuite/g++/../../ 
/localdisk/gcc/tm-src/gcc/testsuite/g++.dg/tm/pr45940-4.C -nostdinc++ 
-I/localdisk/gcc/tm-build-dbg/i686-pc-linux-gnu/libstdc++-v3/include/i686-pc-linux-gnu 
-I/localdisk/gcc/tm-build-dbg/i686-pc-linux-gnu/libstdc++-v3/include 
-I/localdisk/gcc/tm-src/libstdc++-v3/libsupc++ 
-I/localdisk/gcc/tm-src/libstdc++-v3/include/backward 
-I/localdisk/gcc/tm-src/libstdc++-v3/testsuite/util -fmessage-length=0 
-fgnu-tm -O1 -S -o pr45940-4.s
marlier@d01:/localdisk/gcc/tm-build-dbg$ echo $?
0

-> no segfault

Patch

Index: ipa-inline.c
===================================================================
--- ipa-inline.c	(revision 180705)
+++ ipa-inline.c	(working copy)
@@ -285,14 +285,14 @@ 
       inlinable = false;
     }
   /* TM pure functions should not get inlined if the outer function is
-     a TM safe function.  */
+     a TM safe function. ??? TM pure function could be inlined if waiver block
+     is implemented. */
   else if (flag_tm
 	   && is_tm_pure (callee->decl)
 	   && is_tm_safe (e->caller->decl))
     {
       e->inline_failed = CIF_UNSPECIFIED;
-      gimple_call_set_cannot_inline (e->call_stmt, true);
-      return false;
+      inlinable = false;
     }
   /* Don't inline if the callee can throw non-call exceptions but the
      caller cannot.