Commit 91cad09b by Aldy Hernandez Committed by Aldy Hernandez

re PR middle-end/53850 (ICE: in expand_call_tm, at trans-mem.c:2289 with -fgnu-tm -O3)

	PR middle-end/53850
	* trans-mem.c (expand_call_tm): Handle late built built-ins.

From-SVN: r191742
parent 5139232e
2012-09-25 Aldy Hernandez <aldyh@redhat.com>
PR middle-end/53850
* trans-mem.c (expand_call_tm): Handle late built built-ins.
2012-09-25 Georg-Johann Lay <avr@gjlay.de>
PR other/54701
......
/* { dg-do compile } */
/* { dg-options "-fgnu-tm -O3" } */
unsigned char pp[100];
void
foo (void)
{
int i;
__transaction_atomic
{
for (i = 0; i < 100; ++i)
pp[i] = 0x33;
}
}
......@@ -2296,8 +2296,31 @@ expand_call_tm (struct tm_region *region,
}
node = cgraph_get_node (fn_decl);
/* All calls should have cgraph here. */
gcc_assert (node);
/* All calls should have cgraph here. */
if (!node)
{
/* We can have a nodeless call here if some pass after IPA-tm
added uninstrumented calls. For example, loop distribution
can transform certain loop constructs into __builtin_mem*
calls. In this case, see if we have a suitable TM
replacement and fill in the gaps. */
gcc_assert (DECL_BUILT_IN_CLASS (fn_decl) == BUILT_IN_NORMAL);
enum built_in_function code = DECL_FUNCTION_CODE (fn_decl);
gcc_assert (code == BUILT_IN_MEMCPY
|| code == BUILT_IN_MEMMOVE
|| code == BUILT_IN_MEMSET);
tree repl = find_tm_replacement_function (fn_decl);
if (repl)
{
gimple_call_set_fndecl (stmt, repl);
update_stmt (stmt);
node = cgraph_create_node (repl);
node->local.tm_may_enter_irr = false;
return expand_call_tm (region, gsi);
}
gcc_unreachable ();
}
if (node->local.tm_may_enter_irr)
transaction_subcode_ior (region, GTMA_MAY_ENTER_IRREVOCABLE);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment