Re: [PATCH][Middle-end]2nd patch of PR78809 and PR83026

2017-12-15 Thread Qing Zhao
Hi, Wilco, thanks a lot for your review and comments. > On Dec 15, 2017, at 6:41 AM, Wilco Dijkstra wrote: > > Hi Qing, > > Just looking at a very high level, I have a few comments: > > 1. Constant folding str(n)cmp - folding is done separately in > fold-const-call.c > and gimple-fold.c.

Re: [PATCH][Middle-end]2nd patch of PR78809 and PR83026

2017-12-15 Thread Qing Zhao
> On Dec 15, 2017, at 11:47 AM, Jakub Jelinek wrote: > > On Fri, Dec 15, 2017 at 11:17:37AM -0600, Qing Zhao wrote: >> HOST_WIDE_INT const_string_leni = -1; >> >> if (idx1) >>{ >> const_string_leni = compute_string_length (idx1); >> var_string = arg2; >>} >> else if (idx2)

Re: [PATCH][Middle-end]2nd patch of PR78809 and PR83026

2017-12-15 Thread Jakub Jelinek
On Fri, Dec 15, 2017 at 11:17:37AM -0600, Qing Zhao wrote: > HOST_WIDE_INT const_string_leni = -1; > > if (idx1) > { > const_string_leni = compute_string_length (idx1); > var_string = arg2; > } > else if (idx2) > { > const_string_leni = compute_string_length (id

Re: [PATCH][Middle-end]2nd patch of PR78809 and PR83026

2017-12-15 Thread Qing Zhao
> On Dec 15, 2017, at 10:42 AM, Jakub Jelinek wrote: > > On Fri, Dec 15, 2017 at 10:08:03AM -0600, Qing Zhao wrote: >> a little confused here: >> >> in the current code: >> . the first case is: result = strcmp() != 0 >> . the second case is:if (strcmp() != 0) >> >> so, t

Re: [PATCH][Middle-end]2nd patch of PR78809 and PR83026

2017-12-15 Thread Jakub Jelinek
On Fri, Dec 15, 2017 at 10:08:03AM -0600, Qing Zhao wrote: > a little confused here: > > in the current code: > . the first case is: result = strcmp() != 0 > . the second case is:if (strcmp() != 0) > > so, the missing case you mentioned above is: > > result = if

Re: [PATCH][Middle-end]2nd patch of PR78809 and PR83026

2017-12-15 Thread Qing Zhao
Hi, Jakub, thanks a lot for your detailed review. > On Dec 14, 2017, at 2:45 PM, Jakub Jelinek wrote: > > On Thu, Dec 14, 2017 at 01:45:21PM -0600, Qing Zhao wrote: >> 2017-12-11 Qing Zhao mailto:qing.z...@oracle.com>> > > No " " in ChangeLog entries please. thi

Re: [PATCH][Middle-end]2nd patch of PR78809 and PR83026

2017-12-15 Thread Wilco Dijkstra
Hi Qing, Just looking at a very high level, I have a few comments: 1. Constant folding str(n)cmp - folding is done separately in fold-const-call.c and gimple-fold.c. There is already code for folding strcmp and strncmp, so we shouldn't need to add new foldings. Or do you have an example t

Re: [PATCH][Middle-end]2nd patch of PR78809 and PR83026

2017-12-14 Thread Jakub Jelinek
On Thu, Dec 14, 2017 at 01:45:21PM -0600, Qing Zhao wrote: > 2017-12-11 Qing Zhao mailto:qing.z...@oracle.com>> No " " in ChangeLog entries please. > --- a/gcc/tree-ssa-strlen.c > +++ b/gcc/tree-ssa-strlen.c > @@ -2541,6 +2541,198 @@ handle_builtin_memcmp (gimple_st