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: do not pass PR_INSTRUMENTEDCODE if there is no instrumentation


Whoops, wrong patch. This is the latest revision.

On 02/25/13 16:48, Aldy Hernandez wrote:
On 02/22/13 11:27, Richard Henderson wrote:
On 02/21/2013 02:14 PM, Aldy Hernandez wrote:
I suppose we could cheat and avoid passing PR_INSTRUMENTEDCODE if we
ever enter expand_block_tm(), but perhaps we could do a little better as
with the attached patch.

I assume you meant "never enter" there.


Yes, you don't need to "accumulate" GTMA_INSTRUMENTED_CODE.

Probably what should happen is that either

               /* If we're sure to go irrevocable, there won't be
                  anything to expand, since the run-time will go
                  irrevocable right away.  */
               if (sub & GTMA_DOES_GO_IRREVOCABLE
                   && sub & GTMA_MAY_ENTER_IRREVOCABLE)
                 continue;

should in fact set EDGE_TM_UNINSTRUMENTED, or we should set that bit even earlier

I think it's best to do this here at tmmark time, instead of at IPA-tm. Don't we have problems when ipa inlining runs after ipa_tm, thus creating more instrumented code later on?

If so, the attached patch does it at tmmark.  I also cleaned up the
instrumented edges, thus generating:

   <bb 2>:
   tm_state.2_5 = __builtin__ITM_beginTransaction (16458); [
uninstrumentedCode hasNoAbort doesGoIrrevocable readOnly ]
   __asm__ __volatile__("");
   __builtin__ITM_commitTransaction ();

   <bb 3>:
   return;

Which is way better than what we've ever generated... removing the
alternative path altogether.  Yay.

How does this look?
Aldy


       /* If we're sure to go irrevocable, don't transform anything.  */
       if (d->irrevocable_blocks_normal
           && bitmap_bit_p (d->irrevocable_blocks_normal,
                            region->entry_block->index))
         {
           transaction_subcode_ior (region, GTMA_DOES_GO_IRREVOCABLE);
           transaction_subcode_ior (region, GTMA_MAY_ENTER_IRREVOCABLE);
           continue;
         }

And while we're at it, ipa_tm_scan_calls_transaction should probably add a check to skip doing ipa_uninstrument_transaction on transactions that have already been so marked.


Attachment: curr
Description: Text document


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