* [PATCH] Do not fixup edges for a thunk in LTRANS (PR lto/78049)
@ 2016-10-20 15:21 Martin Liška
2016-10-20 15:25 ` Jan Hubicka
0 siblings, 1 reply; 2+ messages in thread
From: Martin Liška @ 2016-10-20 15:21 UTC (permalink / raw)
To: GCC Patches; +Cc: Jan Hubicka
[-- Attachment #1: Type: text/plain, Size: 243 bytes --]
Hello.
Following patch fixes issue mentioned in $subject. Problem is connected to thunks
that become expanded during WPA phase of LTO.
Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.
Ready to be installed?
Martin
[-- Attachment #2: 0001-Do-not-fixup-edges-for-a-thunk-in-LTRANS-PR-lto-7804.patch --]
[-- Type: text/x-patch, Size: 2585 bytes --]
From a41a5b1e3b7451c711c520b38f4603c2976a4b02 Mon Sep 17 00:00:00 2001
From: marxin <mliska@suse.cz>
Date: Thu, 20 Oct 2016 15:33:31 +0200
Subject: [PATCH] Do not fixup edges for a thunk in LTRANS (PR lto/78049)
gcc/ChangeLog:
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.
---
gcc/lto-streamer-in.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/gcc/lto-streamer-in.c b/gcc/lto-streamer-in.c
index f852bf9..1f39e6b 100644
--- a/gcc/lto-streamer-in.c
+++ b/gcc/lto-streamer-in.c
@@ -889,13 +889,16 @@ static void
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]);
@@ -905,7 +908,7 @@ fixup_call_stmt_edges_1 (struct cgraph_node *node, gimple **stmts,
}
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]);
@@ -915,7 +918,7 @@ fixup_call_stmt_edges_1 (struct cgraph_node *node, gimple **stmts,
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];
@@ -937,7 +940,8 @@ fixup_call_stmt_edges (struct cgraph_node *orig, gimple **stmts)
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;)
{
--
2.10.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Do not fixup edges for a thunk in LTRANS (PR lto/78049)
2016-10-20 15:21 [PATCH] Do not fixup edges for a thunk in LTRANS (PR lto/78049) Martin Liška
@ 2016-10-20 15:25 ` Jan Hubicka
0 siblings, 0 replies; 2+ messages in thread
From: Jan Hubicka @ 2016-10-20 15:25 UTC (permalink / raw)
To: Martin Liška; +Cc: GCC Patches, Jan Hubicka
> Hello.
>
> Following patch fixes issue mentioned in $subject. Problem is connected to thunks
> that become expanded during WPA phase of LTO.
>
> Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.
>
> Ready to be installed?
> Martin
> >From a41a5b1e3b7451c711c520b38f4603c2976a4b02 Mon Sep 17 00:00:00 2001
> From: marxin <mliska@suse.cz>
> Date: Thu, 20 Oct 2016 15:33:31 +0200
> Subject: [PATCH] Do not fixup edges for a thunk in LTRANS (PR lto/78049)
>
> gcc/ChangeLog:
>
> 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.
OK,
thanks
Honza
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-10-20 15:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-20 15:21 [PATCH] Do not fixup edges for a thunk in LTRANS (PR lto/78049) Martin Liška
2016-10-20 15:25 ` Jan Hubicka
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).