Message ID | 20190522114156.GG19695@tucnak |
---|---|
State | New |
Headers | show |
Series | Assorted optc-save-gen.awk fixes (PR bootstrap/90543) | expand |
On Wed, May 22, 2019 at 01:41:56PM +0200, Jakub Jelinek wrote: > Ok for trunk if it passes full bootstrap/regtest on x86_64-linux (passed > already normal build on aarch64-linux cross)? Successfully bootstrapped/regtested on x86_64-linux and i686-linux. > 2019-05-22 Jakub Jelinek <jakub@redhat.com> > > PR bootstrap/90543 > * optc-save-gen.awk: In cl_optimization_print, use correct condition > for var_opt_string printing. In cl_optimization_print_diff, print > (null) instead of invoking undefined behavior if one of the > var_opt_string pointers is NULL and use && instead of first || in the > guarding condition. For var_target_other options, handle const char * > target variables similarly to const char * optimize node variables. Jakub
On Wed, May 22, 2019 at 01:41:56PM +0200, Jakub Jelinek wrote: > 2019-05-22 Jakub Jelinek <jakub@redhat.com> > > PR bootstrap/90543 > * optc-save-gen.awk: In cl_optimization_print, use correct condition > for var_opt_string printing. In cl_optimization_print_diff, print > (null) instead of invoking undefined behavior if one of the > var_opt_string pointers is NULL and use && instead of first || in the > guarding condition. For var_target_other options, handle const char * > target variables similarly to const char * optimize node variables. I'd like to ping this patch. Thanks. Jakub
On Wed, 29 May 2019, Jakub Jelinek wrote: > On Wed, May 22, 2019 at 01:41:56PM +0200, Jakub Jelinek wrote: > > 2019-05-22 Jakub Jelinek <jakub@redhat.com> > > > > PR bootstrap/90543 > > * optc-save-gen.awk: In cl_optimization_print, use correct condition > > for var_opt_string printing. In cl_optimization_print_diff, print > > (null) instead of invoking undefined behavior if one of the > > var_opt_string pointers is NULL and use && instead of first || in the > > guarding condition. For var_target_other options, handle const char * > > target variables similarly to const char * optimize node variables. > > I'd like to ping this patch. OK. Richard.
On Sun, Sep 29, 2019 at 06:34:04PM +1000, Michael Chamberlain wrote: > The last line modified above will print ptr1->..., but I think it should be > using ptr2 both in the condition and the true alternative. You're right, fixed thusly, committed as obvious to trunk so far, will backport to 9.3 too. 2019-09-29 Jakub Jelinek <jakub@redhat.com> PR bootstrap/90543 * optc-save-gen.awk: Fix up printing string option differences. --- gcc/optc-save-gen.awk.jj 2019-05-29 11:31:46.073468357 +0200 +++ gcc/optc-save-gen.awk 2019-09-29 12:03:52.338731952 +0200 @@ -332,7 +332,7 @@ for (i = 0; i < n_opt_string; i++) { print " indent_to, \"\","; print " \"" name "\","; print " ptr1->x_" name " ? ptr1->x_" name " : \"(null)\","; - print " ptr2->x_" name " ? ptr1->x_" name " : \"(null)\");"; + print " ptr2->x_" name " ? ptr2->x_" name " : \"(null)\");"; print ""; } Jakub
--- gcc/optc-save-gen.awk.jj 2019-02-15 08:16:22.838993512 +0100 +++ gcc/optc-save-gen.awk 2019-05-22 13:33:11.128183956 +0200 @@ -253,7 +253,7 @@ for (i = 0; i < n_opt_char; i++) { } for (i = 0; i < n_opt_string; i++) { - print " if (ptr->x_" var_opt_char[i] ")"; + print " if (ptr->x_" var_opt_string[i] ")"; print " fprintf (file, \"%*s%s (%s)\\n\","; print " indent_to, \"\","; print " \"" var_opt_string[i] "\","; @@ -326,13 +326,13 @@ for (i = 0; i < n_opt_char; i++) { for (i = 0; i < n_opt_string; i++) { name = var_opt_string[i] print " if (ptr1->x_" name " != ptr2->x_" name ""; - print " || (!ptr1->x_" name" || !ptr2->x_" name + print " && (!ptr1->x_" name" || !ptr2->x_" name print " || strcmp (ptr1->x_" name", ptr2->x_" name ")))"; print " fprintf (file, \"%*s%s (%s/%s)\\n\","; print " indent_to, \"\","; print " \"" name "\","; - print " ptr1->x_" name ","; - print " ptr2->x_" name ");"; + print " ptr1->x_" name " ? ptr1->x_" name " : \"(null)\","; + print " ptr2->x_" name " ? ptr1->x_" name " : \"(null)\");"; print ""; } @@ -349,6 +349,7 @@ n_target_char = 0; n_target_short = 0; n_target_int = 0; n_target_enum = 0; +n_target_string = 0; n_target_other = 0; if (have_save) { @@ -381,6 +382,8 @@ if (have_save) { if (otype == var_type(flags[i])) var_target_range[name] = "" } + else if (otype ~ "^const char \\**$") + var_target_string[n_target_string++] = name; else var_target_other[n_target_other++] = name; } @@ -429,6 +432,10 @@ for (i = 0; i < n_target_char; i++) { print " ptr->x_" var_target_char[i] " = opts->x_" var_target_char[i] ";"; } +for (i = 0; i < n_target_string; i++) { + print " ptr->x_" var_target_string[i] " = opts->x_" var_target_string[i] ";"; +} + print "}"; print ""; @@ -461,6 +468,10 @@ for (i = 0; i < n_target_char; i++) { print " opts->x_" var_target_char[i] " = ptr->x_" var_target_char[i] ";"; } +for (i = 0; i < n_target_string; i++) { + print " opts->x_" var_target_string[i] " = ptr->x_" var_target_string[i] ";"; +} + # This must occur after the normal variables in case the code depends on those # variables. print ""; @@ -530,6 +541,15 @@ for (i = 0; i < n_target_char; i++) { print ""; } +for (i = 0; i < n_target_string; i++) { + print " if (ptr->x_" var_target_string[i] ")"; + print " fprintf (file, \"%*s%s (%s)\\n\","; + print " indent, \"\","; + print " \"" var_target_string[i] "\","; + print " ptr->x_" var_target_string[i] ");"; + print ""; +} + print ""; print " if (targetm.target_option.print)"; print " targetm.target_option.print (file, indent, ptr);"; @@ -605,6 +625,19 @@ for (i = 0; i < n_target_char; i++) { print ""; } +for (i = 0; i < n_target_string; i++) { + name = var_target_string[i] + print " if (ptr1->x_" name " != ptr2->x_" name ""; + print " && (!ptr1->x_" name" || !ptr2->x_" name + print " || strcmp (ptr1->x_" name", ptr2->x_" name ")))"; + print " fprintf (file, \"%*s%s (%s/%s)\\n\","; + print " indent, \"\","; + print " \"" name "\","; + print " ptr1->x_" name " ? ptr1->x_" name " : \"(null)\","; + print " ptr2->x_" name " ? ptr1->x_" name " : \"(null)\");"; + print ""; +} + print "}"; print "";