From: Bernd Edlinger <bernd.edlinger@hotmail.de>
To: Jeff Law <law@redhat.com>,
"gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH][ PR rtl-optimization/79286] Drop may_trap_p exception to testing dominance in update_equiv_regs
Date: Sun, 23 Apr 2017 18:33:00 -0000 [thread overview]
Message-ID: <AM4PR0701MB216261D19300246ACE8F85BEE41C0@AM4PR0701MB2162.eurprd07.prod.outlook.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 395 bytes --]
Hi Jeff,
this patch tries to fix the handling of pic_offset_rtx +
const(unspec(symbol_ref)+ const_int) in may_trap_p,
and restores the original state of affairs in update_equiv_regs.
What do you think is it OK to extract the symbol_ref out
of the unspec in this way, or is does it need a target hook?
Patch works at least for x86_64 and arm.
Is it OK for trunk?
Bernd.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch-pr79286.diff --]
[-- Type: text/x-patch; name="patch-pr79286.diff", Size: 2459 bytes --]
2017-04-23 Bernd Edlinger <bernd.edlinger@hotmail.de>
rtl-optimizatoin/79286
* ira.c (update_equiv_regs): Revert to using may_tap_p again.
* rtlanal.c (rtx_addr_can_trap_p_1): SYMBOL_REF_FUNCTION_P can never
trap. Extract constant offset from pic_offset_table_rtx +
const(unspec(symbol_ref)+int_val) and pic_offset_table_rtx +
const(unspec(symbol_ref)), otherwise RTL may trap.
Index: gcc/ira.c
===================================================================
--- gcc/ira.c (revision 247077)
+++ gcc/ira.c (working copy)
@@ -3551,7 +3551,8 @@ update_equiv_regs (void)
if (DF_REG_DEF_COUNT (regno) == 1
&& note
&& !rtx_varies_p (XEXP (note, 0), 0)
- && def_dominates_uses (regno))
+ && (!may_trap_or_fault_p (XEXP (note, 0))
+ || def_dominates_uses (regno)))
{
rtx note_value = XEXP (note, 0);
remove_note (insn, note);
Index: gcc/rtlanal.c
===================================================================
--- gcc/rtlanal.c (revision 247077)
+++ gcc/rtlanal.c (working copy)
@@ -485,7 +485,7 @@ rtx_addr_can_trap_p_1 (const_rtx x, HOST_WIDE_INT
case SYMBOL_REF:
if (SYMBOL_REF_WEAK (x))
return 1;
- if (!CONSTANT_POOL_ADDRESS_P (x))
+ if (!CONSTANT_POOL_ADDRESS_P (x) && !SYMBOL_REF_FUNCTION_P (x))
{
tree decl;
HOST_WIDE_INT decl_size;
@@ -645,8 +645,23 @@ rtx_addr_can_trap_p_1 (const_rtx x, HOST_WIDE_INT
case PLUS:
/* An address is assumed not to trap if:
- it is the pic register plus a constant. */
- if (XEXP (x, 0) == pic_offset_table_rtx && CONSTANT_P (XEXP (x, 1)))
- return 0;
+ if (XEXP (x, 0) == pic_offset_table_rtx
+ && GET_CODE (XEXP (x, 1)) == CONST)
+ {
+ x = XEXP (XEXP (x, 1), 0);
+ if (GET_CODE (x) == UNSPEC
+ && GET_CODE (XVECEXP (x, 0, 0)) == SYMBOL_REF)
+ return rtx_addr_can_trap_p_1(XVECEXP (x, 0, 0),
+ offset, size, mode, unaligned_mems);
+ if (GET_CODE (x) == PLUS
+ && GET_CODE (XEXP (x, 0)) == UNSPEC
+ && GET_CODE (XVECEXP (XEXP (x, 0), 0, 0)) == SYMBOL_REF
+ && CONST_INT_P (XEXP (x, 1)))
+ return rtx_addr_can_trap_p_1(XVECEXP (XEXP (x, 0), 0, 0),
+ offset + INTVAL (XEXP (x, 1)),
+ size, mode, unaligned_mems);
+ return 1;
+ }
/* - or it is an address that can't trap plus a constant integer. */
if (CONST_INT_P (XEXP (x, 1))
next reply other threads:[~2017-04-23 11:55 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-23 18:33 Bernd Edlinger [this message]
2017-04-28 17:17 ` Jeff Law
2017-04-28 18:05 ` Bernd Edlinger
2017-04-28 19:01 ` Jeff Law
2017-04-28 20:23 ` Bernd Edlinger
2017-04-28 20:27 ` Bernd Edlinger
2017-04-29 9:27 ` Bernd Edlinger
2017-05-12 16:49 ` [PING][PATCH][ " Bernd Edlinger
2017-06-01 16:00 ` [PING**2][PATCH][ " Bernd Edlinger
[not found] ` <59f99a5b-e5db-7078-5f55-c4b42f9c4a8b@hotmail.de>
2017-06-14 12:43 ` [PING**3][PATCH][ " Bernd Edlinger
2017-06-23 4:35 ` [PATCH][ " Jeff Law
-- strict thread matches above, loose matches on Subject: below --
2017-02-24 15:48 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=AM4PR0701MB216261D19300246ACE8F85BEE41C0@AM4PR0701MB2162.eurprd07.prod.outlook.com \
--to=bernd.edlinger@hotmail.de \
--cc=gcc-patches@gcc.gnu.org \
--cc=law@redhat.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).