summaryrefslogtreecommitdiff
path: root/gcc/emit-rtl.c
diff options
context:
space:
mode:
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2011-05-23 17:57:35 +0000
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2011-05-23 17:57:35 +0000
commitb0bd0491a1577445391566d8e32234ea368cd3d2 (patch)
treecbcfd8af4785e068775d431b87251e68e62356bf /gcc/emit-rtl.c
parent5f28ce61231ed1e47f2aa36947fb36ca1db09aa5 (diff)
downloadgcc-b0bd0491a1577445391566d8e32234ea368cd3d2.tar.gz
gcc/
PR rtl-optimization/48826 * emit-rtl.c (try_split): When splitting a call that is followed by a NOTE_INSN_CALL_ARG_LOCATION, move the note after the new call. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@174080 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/emit-rtl.c')
-rw-r--r--gcc/emit-rtl.c27
1 files changed, 25 insertions, 2 deletions
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index 2e073b5da1f..988072b2cbf 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -3470,17 +3470,40 @@ try_split (rtx pat, rtx trial, int last)
}
/* If we are splitting a CALL_INSN, look for the CALL_INSN
- in SEQ and copy our CALL_INSN_FUNCTION_USAGE to it. */
+ in SEQ and copy any additional information across. */
if (CALL_P (trial))
{
for (insn = insn_last; insn ; insn = PREV_INSN (insn))
if (CALL_P (insn))
{
- rtx *p = &CALL_INSN_FUNCTION_USAGE (insn);
+ rtx next, *p;
+
+ /* Add the old CALL_INSN_FUNCTION_USAGE to whatever the
+ target may have explicitly specified. */
+ p = &CALL_INSN_FUNCTION_USAGE (insn);
while (*p)
p = &XEXP (*p, 1);
*p = CALL_INSN_FUNCTION_USAGE (trial);
+
+ /* If the old call was a sibling call, the new one must
+ be too. */
SIBLING_CALL_P (insn) = SIBLING_CALL_P (trial);
+
+ /* If the new call is the last instruction in the sequence,
+ it will effectively replace the old call in-situ. Otherwise
+ we must move any following NOTE_INSN_CALL_ARG_LOCATION note
+ so that it comes immediately after the new call. */
+ if (NEXT_INSN (insn))
+ {
+ next = NEXT_INSN (trial);
+ if (next
+ && NOTE_P (next)
+ && NOTE_KIND (next) == NOTE_INSN_CALL_ARG_LOCATION)
+ {
+ remove_insn (next);
+ add_insn_after (next, insn, NULL);
+ }
+ }
}
}