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]

[trans-mem] PR45940: handle inlining of TM pure functions


This patch removes the kludge disabling all TM pure functions from being inlined, and only disables this behavior when the caller is transactionally safe.

Richard, your original suggestion is below. Instead I decided to add the code in tree_can_inline_p() which has both callee *AND* caller information. Both function_attribute_inlinable_p() and inline_forbidden_p_stmt() which you suggested get called through the inline parameter pass (compute_inline_parameters) which only has information for the callee, not the caller, so we can't determine if the caller was TM safe.

There is no testcase for this patch, as the original tests applicable to this PR test this patch as well.

OK for branch?

p.s. Oh yeah, this concludes the fix, and we can close the PR.

        In function_attribute_inlinable_p, if fndecl is tm_pure and
        current_function_decl is tm_safe, deny the inlining.

             This is because tm_pure is the only escape hatch we
             have for "do not annotate this".  E.g. you want to
             add a call to printf for debugging, or there's some
             data you know that shouldn't be part of the transaction.

             The fix for this is to implement __tm_waiver.  But you
             know yourself how tricky getting just the transaction
             blocks correct has been.  Adding holes within the
             region is... nasty.  But probably required eventually.

        In inline_forbidden_p_stmt, notice asms and prevent them from
        being inlined if current_function_decl is tm_safe.

             This will stop early inlining from breaking tm_safe
             functions when dealing with e.g. system header files
             that include inline asms.


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]