[trans-mem] PR47690: redirect recursive calls in a clone correctly

Aldy Hernandez aldyh@redhat.com
Tue Feb 15 18:35:00 GMT 2011


 >> But in this case, why is NewQueueNode cloned?
 >> It shouldn't because it is never called in a transaction and it is
 >> not a transaction safe function.

You are both right.  I was assuming the function was 
transaction_callable (which, as rth points out, still exhibits the problem).

The reason we are incorrectly cloning the function is because in 
ipa_tm_scan_calls_transaction() we see that the BB for the call is in 
the set of transactional blocks, but we fail to notice that within a 
transactional block, we can have instructions past the end of a 
transaction.  For example:

<bb 2>:
   __transaction
<bb 3>:
   george = 999;
   __builtin__ITM_commitTransaction ();
   NewQueueNode ();
   return;

Here we have BB3 which is in the global set of blocks inside of a 
transaction, but the call to NewQueueNode() is actually beyond the 
commit.  So we must verify that the call in question is not beyond a 
transaction ending statement.  I have done so in the updated patch below.

 > I was about to ask the very same question.  Though if the test case is
 > transformed to add __attribute__((transaction_callable)), then we do
 > have a problem.

Yes, and my original patch fixes this particular problem though I didn't 
even know it at the time :).

 > I must say the "outside_transaction" parameter is faulty to the point
 > of confusing.  Inside a clone, we are *never* outside the transaction;
 > the transaction begins somewhere up the call stack.

How about "past_tm_ending_stmt", that's fairly unambiguous :)?

The attached patch fixes both problems.

OK?



More information about the Gcc-patches mailing list