public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* eliminate dead stores across functions
@ 2018-03-06 12:01 Prathamesh Kulkarni
  2018-03-06 14:28 ` Richard Biener
  0 siblings, 1 reply; 8+ messages in thread
From: Prathamesh Kulkarni @ 2018-03-06 12:01 UTC (permalink / raw)
  To: gcc

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.

Thanks,
Prathamesh

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-03-06 16:52 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-06 12:01 eliminate dead stores across functions Prathamesh Kulkarni
2018-03-06 14:28 ` Richard Biener
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

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).