Re: [PATCH, PR 60461] Fix loop condition at the end of ipa_modify_call_arguments
On Thu, Mar 13, 2014 at 04:56:12PM +0100, Martin Jambor wrote: PR lto/60461 * ipa-prop.c (ipa_modify_call_arguments): Fix iteration condition. testsuite/ * gcc.dg/lto/pr60461_0.c: New test. diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c index 4fb916a..efe8c7a 100644 --- a/gcc/ipa-prop.c +++ b/gcc/ipa-prop.c @@ -3901,7 +3901,7 @@ ipa_modify_call_arguments (struct cgraph_edge *cs, gimple stmt, gsi_prev (gsi); } while ((gsi_end_p (prev_gsi) !gsi_end_p (gsi)) - || (!gsi_end_p (prev_gsi) gsi_stmt (gsi) == gsi_stmt (prev_gsi))); + || (!gsi_end_p (prev_gsi) gsi_stmt (gsi) != gsi_stmt (prev_gsi))); } Doesn't (in 4.8+ of course) gsi_stmt return NULL iff gsi_end_p? Thus, can't this be simplified into: } while (gsi_stmt (gsi) != gsi_stmt (prev_gsi)); ? Jakub
Re: [PATCH, PR 60461] Fix loop condition at the end of ipa_modify_call_arguments
On Thu, Mar 13, 2014 at 05:19:02PM +0100, Jakub Jelinek wrote: On Thu, Mar 13, 2014 at 04:56:12PM +0100, Martin Jambor wrote: PR lto/60461 * ipa-prop.c (ipa_modify_call_arguments): Fix iteration condition. testsuite/ * gcc.dg/lto/pr60461_0.c: New test. diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c index 4fb916a..efe8c7a 100644 --- a/gcc/ipa-prop.c +++ b/gcc/ipa-prop.c @@ -3901,7 +3901,7 @@ ipa_modify_call_arguments (struct cgraph_edge *cs, gimple stmt, gsi_prev (gsi); } while ((gsi_end_p (prev_gsi) !gsi_end_p (gsi)) -|| (!gsi_end_p (prev_gsi) gsi_stmt (gsi) == gsi_stmt (prev_gsi))); +|| (!gsi_end_p (prev_gsi) gsi_stmt (gsi) != gsi_stmt (prev_gsi))); } Doesn't (in 4.8+ of course) gsi_stmt return NULL iff gsi_end_p? Thus, can't this be simplified into: } while (gsi_stmt (gsi) != gsi_stmt (prev_gsi)); ? Apparently it does. I will commit the simplified condition after testing then. Thanks, Martin