re PR middle-end/47530 ([trans-mem] tail call optimization problem with _ITM_commitTransaction)

PR middle-end/47530
	* trans-mem.c (expand_block_edges): Do not skip the first
	statement when resetting the BB.

From-SVN: r188191
This commit is contained in:
Aldy Hernandez 2012-06-04 16:52:47 +00:00 committed by Aldy Hernandez
parent 7ba92f0a85
commit f839c2bf29
3 changed files with 45 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2012-06-04 Aldy Hernandez <aldyh@redhat.com>
PR middle-end/47530
* trans-mem.c (expand_block_edges): Do not skip the first
statement when resetting the BB.
2012-06-04 Richard Guenther <rguenther@suse.de>
PR middle-end/53471

View File

@ -0,0 +1,35 @@
// { dg-do compile }
// { dg-options "-fgnu-tm -O2 -fno-inline -fdump-tree-tmedge" }
class RBTree
{
struct RBNode
{
RBNode* next;
};
public:
RBNode* sentinel;
__attribute__((transaction_safe)) bool lookup();
};
bool RBTree::lookup()
{
RBNode* x = sentinel;
while (x)
x = x->next;
return false;
}
RBTree* SET;
void bench_test()
{
__transaction_atomic {
SET->lookup();
}
}
// { dg-final { scan-tree-dump-times "ITM_commitTransaction.*tail call" 0 "tmedge" } }
// { dg-final { cleanup-tree-dump "tmedge" } }

View File

@ -2585,6 +2585,7 @@ expand_block_edges (struct tm_region *region, basic_block bb)
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); )
{
bool do_next = true;
gimple stmt = gsi_stmt (gsi);
/* ??? TM_COMMIT (and any other tm builtin function) in a nested
@ -2606,6 +2607,7 @@ expand_block_edges (struct tm_region *region, basic_block bb)
make_tm_edge (stmt, bb, region);
bb = e->dest;
gsi = gsi_start_bb (bb);
do_next = false;
}
/* Delete any tail-call annotation that may have been added.
@ -2614,7 +2616,8 @@ expand_block_edges (struct tm_region *region, basic_block bb)
gimple_call_set_tail (stmt, false);
}
gsi_next (&gsi);
if (do_next)
gsi_next (&gsi);
}
}