public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jeff Law <law@redhat.com>
To: Bernd Schmidt <bschmidt@redhat.com>,
	       GCC Patches <gcc-patches@gcc.gnu.org>,
	       Jakub Jelinek <jakub@redhat.com>,
	Sebastian Pop <sebpop@gmail.com>
Subject: Re: Remove noce_mem_write_may_trap_or_fault_p in ifcvt
Date: Fri, 06 Nov 2015 21:09:00 -0000	[thread overview]
Message-ID: <563D170B.3010800@redhat.com> (raw)
In-Reply-To: <563CFFC0.6020908@redhat.com>

On 11/06/2015 12:30 PM, Bernd Schmidt wrote:
> On 11/06/2015 08:20 PM, Jeff Law wrote:
>> So maybe what noce_mem_write_may_trap_or_fault_p is really trying to do
>> is take objects where may_trap_or_fault_p returns false, but which in
>> fact may fault if we write that memory?  ie, working around lameness in
>> may_trap_or_fault_p not knowing the context (ie read vs write).
>
> Yes exactly, that is the aim - detect extra possibilities for faults
> knowing that the context is a write.
>
>> I think what we really want here is to fix may_trap_or_fault_p to be
>> safe.  It's returning "false" in cases where it really ought be
>> returning "true".  Then we just use may_trap_or_fault_p, dropping
>> noce_mem_write_may_trap_or_fault_p.
>
> Well, I think if MEM_READONLY_P is insufficient (and I guess people
> could cast away const - bother), then the current
> noce_mem_write_may_trap_or_fault_p should be simplified to "return
> true;" and eliminated.  We could try to special case stack accesses
> within a known limit later on.
>
> Maybe it doesn't even matter given that we call noce_can_store_speculate
> immediately after this test.
may_trap_or_fault_p already has this kind of knowledge.  It just doesn't 
know if the memory is a read or a write.  Hence my suggestion we should 
fix may_trap_or_fault_p.

Essentially we pass in the type of access, read, write, unknown (where 
unknown must essentially be treated as write).  That gets passed down 
into the helpers where it's taken into account.  Particularly in 
rtx_addr_can_trap_p_1.

My concern with relying on MEM_READONLY_P and/or may_trap_or_fault_p is 
we know that may_trap_or_fault_p been called before in cases where it's 
returned false for readonly memory locations.  Ripping out 
noce_mem_write_may_trap_or_fault_p without fixing may_trap_or_fault_p 
introduces a latent code code generation issue.

Jeff

  reply	other threads:[~2015-11-06 21:09 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-06 17:21 Bernd Schmidt
2015-11-06 18:39 ` Jeff Law
2015-11-06 18:44   ` Bernd Schmidt
2015-11-06 19:20     ` Jeff Law
2015-11-06 19:30       ` Bernd Schmidt
2015-11-06 21:09         ` Jeff Law [this message]
2015-11-18 19:16           ` Bernd Schmidt
2015-11-18 23:49             ` Jeff Law
2015-11-20 14:09               ` Bernd Schmidt
2015-11-20 18:57                 ` Jeff Law
2015-11-23 16:07                   ` Michael Matz
2015-11-25 10:46                     ` Bernd Schmidt
2015-11-25 11:53                       ` Richard Biener
2015-11-25 13:18                         ` Michael Matz
2015-11-25 14:52                           ` Richard Biener
2015-11-25 15:02                             ` Jakub Jelinek
2015-11-25 15:18                               ` Michael Matz
2015-11-25 15:49                               ` Bernd Schmidt
2015-11-25 15:55                                 ` Michael Matz
2015-11-26  9:50                                   ` Richard Biener
2015-11-27 10:22                                     ` Bernd Schmidt
2015-11-25 13:18                       ` Michael Matz
2015-11-25 10:36                   ` Bernd Schmidt
2015-11-23 16:03                 ` Michael Matz

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=563D170B.3010800@redhat.com \
    --to=law@redhat.com \
    --cc=bschmidt@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=sebpop@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).