Do not push new_version->lowered setting into the core routine but keep it at the callers.
Well, why didn't you say so? :). That can't be hard :). I'm testing this. How does it look?
Index: ChangeLog.tm-merge =================================================================== --- ChangeLog.tm-merge (revision 181098) +++ ChangeLog.tm-merge (working copy) @@ -67,8 +67,7 @@ (struct cgraph_local_info): Add tm_may_enter_irr. (cgraph_copy_node_for_versioning): Declare. * cgraphunit.c (cgraph_copy_node_for_versioning): Export; - copy analyzed from old version. Move setting lowered to true from ... - (cgraph_function_versioning): ... here. + copy analyzed from old version. * combine.c (distribute_notes): Handle REG_TM notes. * common.opt: Add -fgnu-tm. * crtstuff.c (__TMC_LIST__, __TMC_END__): New. Index: cgraphunit.c =================================================================== --- cgraphunit.c (revision 181098) +++ cgraphunit.c (working copy) @@ -2294,7 +2294,6 @@ cgraph_copy_node_for_versioning (struct new_version->rtl = old_version->rtl; new_version->reachable = true; new_version->count = old_version->count; - new_version->lowered = true; for (e = old_version->callees; e; e=e->next_callee) if (!bbs_to_copy @@ -2390,6 +2389,7 @@ cgraph_function_versioning (struct cgrap DECL_VIRTUAL_P (new_version_node->decl) = 0; new_version_node->local.externally_visible = 0; new_version_node->local.local = 1; + new_version_node->lowered = true; /* Update the call_expr on the edges to call the new version node. */ update_call_expr (new_version_node); Index: trans-mem.c =================================================================== --- trans-mem.c (revision 181098) +++ trans-mem.c (working copy) @@ -4219,6 +4219,7 @@ ipa_tm_create_version (struct cgraph_nod DECL_COMDAT_GROUP (new_decl) = tm_mangle (DECL_COMDAT_GROUP (old_decl)); new_node = cgraph_copy_node_for_versioning (old_node, new_decl, NULL, NULL); + new_node->lowered = true; new_node->tm_clone = 1; get_cg_data (old_node)->clone = new_node;