Re: eliminate dead stores across functions

2018-03-06 Thread Bin.Cheng
On Tue, Mar 6, 2018 at 4:50 PM, Bin.Cheng wrote: > On Tue, Mar 6, 2018 at 4:44 PM, Martin Jambor wrote: >> Hi Bin, >> >> On Tue, Mar 06 2018, Bin Cheng wrote: >>> On Tue, Mar 6, 2018 at 2:28 PM, Richard Biener Do you think the situation happens

Re: eliminate dead stores across functions

2018-03-06 Thread Bin.Cheng
On Tue, Mar 6, 2018 at 4:44 PM, Martin Jambor wrote: > Hi Bin, > > On Tue, Mar 06 2018, Bin Cheng wrote: >> On Tue, Mar 6, 2018 at 2:28 PM, Richard Biener >>> >>> Do you think the situation happens often enough to make this worthwhile? >> There is one probably more useful case.

Re: eliminate dead stores across functions

2018-03-06 Thread William Cohen
On 03/06/2018 09:28 AM, Richard Biener wrote: > On Tue, Mar 6, 2018 at 1:00 PM, Prathamesh Kulkarni > wrote: >> Hi, >> For the following test-case, >> >> int a; >> >> __attribute__((noinline)) >> static void foo() >> { >> a = 3; >> } >> >> int main() >> { >> a

Re: eliminate dead stores across functions

2018-03-06 Thread Martin Jambor
Hi Bin, On Tue, Mar 06 2018, Bin Cheng wrote: > On Tue, Mar 6, 2018 at 2:28 PM, Richard Biener >> >> Do you think the situation happens often enough to make this worthwhile? > There is one probably more useful case. Program may use global flags > controlling > how it does (heavy) computation.

Re: eliminate dead stores across functions

2018-03-06 Thread Richard Biener
On Tue, Mar 6, 2018 at 4:50 PM, Bin.Cheng wrote: > On Tue, Mar 6, 2018 at 2:28 PM, Richard Biener > wrote: >> On Tue, Mar 6, 2018 at 1:00 PM, Prathamesh Kulkarni >> wrote: >>> Hi, >>> For the following test-case,

Re: eliminate dead stores across functions

2018-03-06 Thread Bin.Cheng
On Tue, Mar 6, 2018 at 2:28 PM, Richard Biener wrote: > On Tue, Mar 6, 2018 at 1:00 PM, Prathamesh Kulkarni > wrote: >> Hi, >> For the following test-case, >> >> int a; >> >> __attribute__((noinline)) >> static void foo() >> { >> a =

Re: eliminate dead stores across functions

2018-03-06 Thread Richard Biener
On Tue, Mar 6, 2018 at 1:00 PM, Prathamesh Kulkarni 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

eliminate dead stores across functions

2018-03-06 Thread Prathamesh Kulkarni
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