+2016-10-20 Martin Liska <mliska@suse.cz>
+
+ PR lto/78049
+ * lto-streamer-in.c (fixup_call_stmt_edges_1): Replace value
+ comparison with STMT_UID_NOT_IN_RANGE.
+ (fixup_call_stmt_edges): Do not fixup edges of a thunk in
+ LTRANS.
+
2016-10-20 Eric Botcazou <ebotcazou@adacore.com>
* compare-elim.c (conforming_compare): Accept UNSPECs.
fixup_call_stmt_edges_1 (struct cgraph_node *node, gimple **stmts,
struct function *fn)
{
+#define STMT_UID_NOT_IN_RANGE(uid) \
+ (gimple_stmt_max_uid (fn) < uid || uid == 0)
+
struct cgraph_edge *cedge;
struct ipa_ref *ref = NULL;
unsigned int i;
for (cedge = node->callees; cedge; cedge = cedge->next_callee)
{
- if (gimple_stmt_max_uid (fn) < cedge->lto_stmt_uid)
+ if (STMT_UID_NOT_IN_RANGE (cedge->lto_stmt_uid))
fatal_error (input_location,
"Cgraph edge statement index out of range");
cedge->call_stmt = as_a <gcall *> (stmts[cedge->lto_stmt_uid - 1]);
}
for (cedge = node->indirect_calls; cedge; cedge = cedge->next_callee)
{
- if (gimple_stmt_max_uid (fn) < cedge->lto_stmt_uid)
+ if (STMT_UID_NOT_IN_RANGE (cedge->lto_stmt_uid))
fatal_error (input_location,
"Cgraph edge statement index out of range");
cedge->call_stmt = as_a <gcall *> (stmts[cedge->lto_stmt_uid - 1]);
for (i = 0; node->iterate_reference (i, ref); i++)
if (ref->lto_stmt_uid)
{
- if (gimple_stmt_max_uid (fn) < ref->lto_stmt_uid)
+ if (STMT_UID_NOT_IN_RANGE (ref->lto_stmt_uid))
fatal_error (input_location,
"Reference statement index out of range");
ref->stmt = stmts[ref->lto_stmt_uid - 1];
orig = orig->clone_of;
fn = DECL_STRUCT_FUNCTION (orig->decl);
- fixup_call_stmt_edges_1 (orig, stmts, fn);
+ if (!orig->thunk.thunk_p)
+ fixup_call_stmt_edges_1 (orig, stmts, fn);
if (orig->clones)
for (node = orig->clones; node != orig;)
{