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]

Re: [Bug c++/46269] [trans-mem] internal compiler error in expand_block_tm of trans-mem.c


On Thu, Nov 11, 2010 at 08:02:50AM -0800, Richard Henderson wrote:
> On 11/10/2010 01:43 PM, Aldy Hernandez wrote:
> >  	case GIMPLE_ASM:
> > -	  gcc_unreachable ();
> > +	  {
> > +	    gimple g;
> > +	    g = gimple_build_call (built_in_decls[BUILT_IN_TM_IRREVOCABLE], 0);
> > +	    gimple_set_location (g, gimple_location (stmt));
> > +	    gsi_insert_before (&gsi, g, GSI_SAME_STMT);
> > +	    transaction_subcode_ior (region, GTMA_MAY_ENTER_IRREVOCABLE);
> > +	    break;
> 
> The reason there's a gcc_unreachable there is that we're supposed to
> have already handled this case.
> 
> See ipa_tm_scan_irr_block where we notice the asm, and ipa_tm_scan_irr_blocks
> where we mark the block as irrevocable.  See ipa_tm_transform_calls_1 where
> we insert the irrevocable call at the head of blocks so marked.

Actually, that had been my first approach, but ipa_tm_scan_irr_function
(and consequently ipa_tm_scan_irr_block*) only gets called for items in
the worklist.  And the worklist is only populated for:

      /* Some callees cannot be arbitrarily cloned.  These will always be
	 irrevocable.  Mark these now, so that we need not scan them.  */
-->    if (is_tm_irrevocable (node->decl)
	  || (a >= AVAIL_OVERWRITABLE
	      && !tree_versionable_function_p (node->decl)))
	ipa_tm_note_irrevocable (node, &worklist);

Since updateBuildingSite() is not makred as irrevocable,
is_tm_irrevoable() returns false, and we never do the
ipa_tm_scan_irr_block() thing you expect.

I thought about teaching is_tm_irrevocable() to look at the
tm_may_enter_irr bit you set in the IPA diagnose pass, but when that
runs, we haven't run the inliner so we don't see the asm statement.

Aldy


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