From: Jakub Jelinek <jakub@redhat.com>
To: Jeff Law <law@redhat.com>, John David Anglin <dave.anglin@bell.net>
Cc: Richard Biener <richard.guenther@gmail.com>,
"H.J. Lu" <hjl.tools@gmail.com>,
GCC Patches <gcc-patches@gcc.gnu.org>
Subject: [PATCH] Fix up DSE - PR middle-end/64388, target/55023
Date: Tue, 06 Jan 2015 14:08:00 -0000 [thread overview]
Message-ID: <20150106140805.GK1667@tucnak.redhat.com> (raw)
In-Reply-To: <20150105213117.GZ1667@tucnak.redhat.com>
Hi!
On Mon, Jan 05, 2015 at 10:31:17PM +0100, Jakub Jelinek wrote:
> Or you could e.g. do the
> if (HARD_FRAME_POINTER_IS_ARG_POINTER
> && !reload_completed
> && SIBLING_CALL_P (insn))
> { add_wild_read (bb_info); return; }
> case first, then compute const_call and memset_call,
> if (const_call || memset_call)
> { current_big_block }
> else if (reload_completed && SIBLING_CALL_P (insn))
> add_wild_read (bb_info);
> else
> add_non_frame_wild_read (bb_info);
>
> That way, you would not punish const/memset calls unnecessarily after reload
> when they are sibling calls.
So what about this way? Even for the HARD_FRAME_POINTER_IS_ARG_POINTER
before reload case, there is no reason for wild read IMHO, just setting
frame_read should do all that is necessary. Bootstrapped/regtested on
x86_64-linux and i686-linux, tested on the pr55023 testcase with cross
to hppa-linux. Ok for trunk?
2015-01-06 Jakub Jelinek <jakub@redhat.com>
PR target/55023
PR middle-end/64388
* dse.c (struct insn_info): Mention frame_read set also
before reload for tail calls on some targets.
(scan_insn): Revert 2014-12-22 change. Set frame_read
also before reload for tail calls if
HARD_FRAME_POINTER_IS_ARG_POINTER. Call add_wild_read
instead of add_non_frame_wild_read for non-const/memset
tail calls after reload.
--- gcc/dse.c.jj 2015-01-05 22:41:19.000000000 +0100
+++ gcc/dse.c 2015-01-06 11:39:39.450832915 +0100
@@ -371,9 +371,11 @@ struct insn_info
either stack pointer or hard frame pointer based. This means
that we have no other choice than also killing all the frame
pointer based stores upon encountering a const function call.
- This field is set after reload for const function calls. Having
- this set is less severe than a wild read, it just means that all
- the frame related stores are killed rather than all the stores. */
+ This field is set after reload for const function calls and before
+ reload for const tail function calls on targets where arg pointer
+ is the frame pointer. Having this set is less severe than a wild
+ read, it just means that all the frame related stores are killed
+ rather than all the stores. */
bool frame_read;
/* This field is only used for the processing of const functions.
@@ -2483,17 +2485,6 @@ scan_insn (bb_info_t bb_info, rtx_insn *
insn_info->cannot_delete = true;
- /* Arguments for a sibling call that are pushed to memory are passed
- using the incoming argument pointer of the current function. These
- may or may not be frame related depending on the target. Since
- argument pointer related stores are not currently tracked, we treat
- a sibling call as though it does a wild read. */
- if (SIBLING_CALL_P (insn))
- {
- add_wild_read (bb_info);
- return;
- }
-
/* Const functions cannot do anything bad i.e. read memory,
however, they can read their parameters which may have
been pushed onto the stack.
@@ -2527,7 +2518,13 @@ scan_insn (bb_info_t bb_info, rtx_insn *
const_call ? "const" : "memset", INSN_UID (insn));
/* See the head comment of the frame_read field. */
- if (reload_completed)
+ if (reload_completed
+ /* Tail calls are storing their arguments using
+ arg poinnter. If it is a frame pointer on the target,
+ even before reload we need to kill frame pointer based
+ stores. */
+ || (SIBLING_CALL_P (insn)
+ && HARD_FRAME_POINTER_IS_ARG_POINTER))
insn_info->frame_read = true;
/* Loop over the active stores and remove those which are
@@ -2601,7 +2598,11 @@ scan_insn (bb_info_t bb_info, rtx_insn *
}
}
}
-
+ else if (SIBLING_CALL_P (insn) && reload_completed)
+ /* Arguments for a sibling call that are pushed to memory are passed
+ using the incoming argument pointer of the current function. After
+ reload that might be (and likely is) frame pointer based. */
+ add_wild_read (bb_info);
else
/* Every other call, including pure functions, may read any memory
that is not relative to the frame. */
Jakub
next prev parent reply other threads:[~2015-01-06 14:08 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-31 14:31 PATCH: [5 Regression] r219037 caused FAIL: gcc.dg/pr44194-1.c H.J. Lu
2015-01-03 17:35 ` John David Anglin
2015-01-03 19:48 ` H.J. Lu
2015-01-03 20:10 ` John David Anglin
2015-01-03 20:18 ` H.J. Lu
2015-01-03 20:58 ` John David Anglin
2015-01-03 21:48 ` H.J. Lu
2015-01-04 11:37 ` Richard Biener
2015-01-04 14:57 ` H.J. Lu
2015-01-04 17:16 ` Richard Biener
2015-01-05 14:19 ` Jeff Law
2015-01-05 18:51 ` Jakub Jelinek
2015-01-05 20:17 ` John David Anglin
2015-01-05 21:24 ` Jakub Jelinek
2015-01-05 21:31 ` Jakub Jelinek
2015-01-06 14:08 ` Jakub Jelinek [this message]
2015-01-06 17:06 ` [PATCH] Fix up DSE - PR middle-end/64388, target/55023 John David Anglin
2015-01-06 19:12 ` Jakub Jelinek
2015-01-08 21:25 ` Jeff Law
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150106140805.GK1667@tucnak.redhat.com \
--to=jakub@redhat.com \
--cc=dave.anglin@bell.net \
--cc=gcc-patches@gcc.gnu.org \
--cc=hjl.tools@gmail.com \
--cc=law@redhat.com \
--cc=richard.guenther@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).