From: Jakub Jelinek <jakub@redhat.com>
To: Kenneth Zadeck <zadeck@naturalbridge.com>,
Ian Lance Taylor <iant@google.com>
Cc: gcc-patches@gcc.gnu.org
Subject: [PATCH] EH_USES df fix (PR target/37378)
Date: Mon, 27 Oct 2008 15:24:00 -0000 [thread overview]
Message-ID: <20081027134736.GT14706@tyan-ft48-01.lab.bos.redhat.com> (raw)
Hi!
Up to 4.1 flow.c used EH_USES in 2 places, to mark registers used on EH
edges and registers used after by bb's without successors (that means
usually noreturn calls). While the epilogue explicitly uses all EH_USES
registers (it restores various special registers from the values saved in
EH_USES registers and the special registers are said to be live at the end
of epilogue), with noreturn calls the epilogue isn't reached, yet we still
need EH_USES registers to be live from the insn which saved special register
into a particular EH_USES register until the last insn in the function
(in this case the noreturn call). We need them for 2 reasons:
1) for every insn that might throw externally (i.e. not be caught within
the same function, but parent etc.), the EH_USES registers are used
by the unwinder
2) for debugging purposes, we need those registers to be live at every
single insn within the function once the special register has been
clobbered
While for 1) we could add explicit artificial uses to every such potentially
throwing insn, for 2) it would be a very bad idea. And even for 1) it would
be IMHO an overkill, as the insns in prologue that save special regs into
EH_USES registers are all RTX_FRAME_RELATED_P and thus can't be simply
removed as unneeded. So it is IMHO enough to say EH_USES registers
are used by top of BBs with incoming EH edges (this has been already done in
df) and by noreturn calls. Otherwise we risk that the saving insn in the
prologue is moved beyond a branch to bb's ending with noreturn call, as
can be seen in miscompiled _Jv_divI (see PR).
The other hunk just removes an unnecessary nop - EH_USES is only defined
(to non-0) on ia64 and only if reload_completed, but it has been used
inside of if (!reload_completed), so it actually never could make any
difference.
Bootstrapped/regtested on ia64-linux, libjava make check now looks
much better than before:
FAIL: getlocalvartable output
FAIL: Throw_3 -O3 output - source compiled test
FAIL: Throw_3 -O3 -findirect-dispatch output - source compiled test
Ok for trunk?
2008-10-27 Jakub Jelinek <jakub@redhat.com>
PR target/37378
* df-scan.c (df_get_call_refs): For unconditional noreturn
calls add EH_USES regs as artificial uses.
(df_get_entry_block_def_set): Don't handle EH_USES here.
--- gcc/df-scan.c.jj 2008-10-14 07:58:50.000000000 -0400
+++ gcc/df-scan.c 2008-10-27 07:26:20.000000000 -0400
@@ -3406,7 +3406,22 @@ df_get_call_refs (struct df_collection_r
}
BITMAP_FREE (defs_generated);
- return;
+
+#ifdef EH_USES
+ if ((flags & DF_REF_CONDITIONAL) == 0
+ && find_reg_note (insn_info->insn, REG_NORETURN, 0))
+ {
+ unsigned int i;
+ /* This code is putting in an artificial ref for the use at the
+ BOTTOM of the block with noreturn call, as EH_USES registers need
+ to be live until epilogue or noreturn call, for debugging purposes
+ as well as any insns that might throw. */
+ for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
+ if (EH_USES (i))
+ df_ref_record (DF_REF_ARTIFICIAL, collection_rec, regno_reg_rtx[i],
+ NULL, bb, NULL, DF_REF_REG_USE, 0, -1, -1, 0);
+ }
+#endif
}
/* Collect all refs in the INSN. This function is free of any
@@ -3826,16 +3841,6 @@ df_get_entry_block_def_set (bitmap entry
/* These registers are live everywhere. */
if (!reload_completed)
{
-#ifdef EH_USES
- /* The ia-64, the only machine that uses this, does not define these
- until after reload. */
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- if (EH_USES (i))
- {
- bitmap_set_bit (entry_block_defs, i);
- }
-#endif
-
#if FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM
/* Pseudos with argument area equivalences may require
reloading via the argument pointer. */
Jakub
next reply other threads:[~2008-10-27 13:47 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-27 15:24 Jakub Jelinek [this message]
2008-10-27 21:14 ` [PATCH] EH_USES df fix (PR target/37378, take 2) Jakub Jelinek
2008-10-27 23:55 ` Kenneth Zadeck
2008-10-28 11:27 ` Eric Botcazou
2008-10-28 11:30 ` Jakub Jelinek
2008-11-24 11:15 ` Eric Botcazou
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=20081027134736.GT14706@tyan-ft48-01.lab.bos.redhat.com \
--to=jakub@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=iant@google.com \
--cc=zadeck@naturalbridge.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).