public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <richard.guenther@gmail.com>
To: Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org>
Cc: GCC Development <gcc@gcc.gnu.org>
Subject: Re: eliminate dead stores across functions
Date: Tue, 06 Mar 2018 14:28:00 -0000	[thread overview]
Message-ID: <CAFiYyc0ZwKqyfX2hyFS+s7tB=gaEJ5OS1zq6BciDFLnn=ynM3w@mail.gmail.com> (raw)
In-Reply-To: <CAAgBjMkcuch04W94DB06Vv7oYZQPLk2VRN5ALd_0Vt=CmzZ=-w@mail.gmail.com>

On Tue, Mar 6, 2018 at 1:00 PM, Prathamesh Kulkarni
<prathamesh.kulkarni@linaro.org> wrote:
> Hi,
> For the following test-case,
>
> int a;
>
> __attribute__((noinline))
> static void foo()
> {
>   a = 3;
> }
>
> int main()
> {
>   a = 4;
>   foo ();
>   return a;
> }
>
> I assume it's safe to remove "a = 4"  since 'a' would be overwritten
> by call to foo ?
> IIUC, ipa-reference pass does mod/ref analysis to compute side-effects
> of function call,
> so could we perhaps use ipa_reference_get_not_written_global() in dse
> pass to check if a global variable will be killed on call to a
> function ? If not, I suppose we could write a similar ipa pass that
> computes the set of killed global variables per function but I am not
> sure if that's the correct approach.

Do you think the situation happens often enough to make this worthwhile?

ipa-reference doesn't compute must-def, only may-def and may-use IIRC.

Richard.

> Thanks,
> Prathamesh

  reply	other threads:[~2018-03-06 14:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-06 12:01 Prathamesh Kulkarni
2018-03-06 14:28 ` Richard Biener [this message]
2018-03-06 15:50   ` Bin.Cheng
2018-03-06 16:09     ` Richard Biener
2018-03-06 16:44     ` Martin Jambor
2018-03-06 16:50       ` Bin.Cheng
2018-03-06 16:52         ` Bin.Cheng
2018-03-06 16:49   ` William Cohen

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='CAFiYyc0ZwKqyfX2hyFS+s7tB=gaEJ5OS1zq6BciDFLnn=ynM3w@mail.gmail.com' \
    --to=richard.guenther@gmail.com \
    --cc=gcc@gcc.gnu.org \
    --cc=prathamesh.kulkarni@linaro.org \
    /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).