Re: [PATCH] Analyze niter for until-wrap condition [PR101145]

2021-07-02 Thread guojiufu via Gcc-patches
On 2021-07-01 20:35, Richard Biener wrote: On Thu, 1 Jul 2021, Jiufu Guo wrote: For code like: unsigned foo(unsigned val, unsigned start) { unsigned cnt = 0; for (unsigned i = start; i > val; ++i) cnt++; return cnt; } The number of iterations should be about UINT_MAX - start. For

Re: [PATCH] Analyze niter for until-wrap condition [PR101145]

2021-07-01 Thread guojiufu via Gcc-patches
On 2021-07-02 08:51, Bin.Cheng wrote: On Thu, Jul 1, 2021 at 10:15 PM guojiufu via Gcc-patches wrote: On 2021-07-01 20:35, Richard Biener wrote: > On Thu, 1 Jul 2021, Jiufu Guo wrote: > >> For code like: >> unsigned foo(unsigned val, unsigned start) >> { >> unsigned cnt = 0; >> for (unsign

Re: [PATCH] Analyze niter for until-wrap condition [PR101145]

2021-07-01 Thread Bin.Cheng via Gcc-patches
On Thu, Jul 1, 2021 at 10:15 PM guojiufu via Gcc-patches wrote: > > On 2021-07-01 20:35, Richard Biener wrote: > > On Thu, 1 Jul 2021, Jiufu Guo wrote: > > > >> For code like: > >> unsigned foo(unsigned val, unsigned start) > >> { > >> unsigned cnt = 0; > >> for (unsigned i = start; i > val; +

Re: [PATCH] Analyze niter for until-wrap condition [PR101145]

2021-07-01 Thread guojiufu via Gcc-patches
On 2021-07-01 20:35, Richard Biener wrote: On Thu, 1 Jul 2021, Jiufu Guo wrote: For code like: unsigned foo(unsigned val, unsigned start) { unsigned cnt = 0; for (unsigned i = start; i > val; ++i) cnt++; return cnt; } The number of iterations should be about UINT_MAX - start. For

Re: [PATCH] Analyze niter for until-wrap condition [PR101145]

2021-07-01 Thread Richard Biener
On Thu, 1 Jul 2021, Jiufu Guo wrote: > For code like: > unsigned foo(unsigned val, unsigned start) > { > unsigned cnt = 0; > for (unsigned i = start; i > val; ++i) > cnt++; > return cnt; > } > > The number of iterations should be about UINT_MAX - start. For unsigned foo(unsigned val,

Re: [PATCH] Analyze niter for until-wrap condition [PR101145]

2021-07-01 Thread guojiufu via Gcc-patches
On 2021-07-01 15:22, Bin.Cheng wrote: On Thu, Jul 1, 2021 at 10:06 AM Jiufu Guo via Gcc-patches wrote: For code like: unsigned foo(unsigned val, unsigned start) { unsigned cnt = 0; for (unsigned i = start; i > val; ++i) cnt++; return cnt; } The number of iterations should be about U

Re: [PATCH] Analyze niter for until-wrap condition [PR101145]

2021-07-01 Thread Bin.Cheng via Gcc-patches
On Thu, Jul 1, 2021 at 10:06 AM Jiufu Guo via Gcc-patches wrote: > > For code like: > unsigned foo(unsigned val, unsigned start) > { > unsigned cnt = 0; > for (unsigned i = start; i > val; ++i) > cnt++; > return cnt; > } > > The number of iterations should be about UINT_MAX - start. > >

[PATCH] Analyze niter for until-wrap condition [PR101145]

2021-06-30 Thread Jiufu Guo via Gcc-patches
For code like: unsigned foo(unsigned val, unsigned start) { unsigned cnt = 0; for (unsigned i = start; i > val; ++i) cnt++; return cnt; } The number of iterations should be about UINT_MAX - start. There is function adjust_cond_for_loop_until_wrap which handles similar work for const bas