I incorporated all the comments and committed the change (also fixed a test failure with --help=optimizers).
thanks, David On Mon, Sep 16, 2013 at 3:07 AM, Richard Biener <richard.guent...@gmail.com> wrote: > On Fri, Sep 13, 2013 at 6:56 PM, Xinliang David Li <davi...@google.com> wrote: >> Updated patch implementing the logic that more specific option wins. >> >> Ok for trunk? > > @@ -2305,8 +2305,8 @@ omp_max_vf (void) > { > if (!optimize > || optimize_debug > - || (!flag_tree_vectorize > - && global_options_set.x_flag_tree_vectorize)) > + || (!flag_tree_loop_vectorize > + && global_options_set.x_flag_tree_loop_vectorize)) > return 1; > > Not sure what is the intent here, but it looks like > -fno-tree-vectorize will no longer disable this. So it would > need to check (global_options_set.x_flag_tree_vectorize || > global_options_set.x_flag_tree_loop_vectorize)? Jakub? > > int vs = targetm.vectorize.autovectorize_vector_sizes (); > @@ -5684,10 +5684,10 @@ expand_omp_simd (struct omp_region *regi > loop->simduid = OMP_CLAUSE__SIMDUID__DECL (simduid); > cfun->has_simduid_loops = true; > } > - /* If not -fno-tree-vectorize, hint that we want to vectorize > + /* If not -fno-tree-loop-vectorize, hint that we want to vectorize > the loop. */ > - if ((flag_tree_vectorize > - || !global_options_set.x_flag_tree_vectorize) > + if ((flag_tree_loop_vectorize > + || !global_options_set.x_flag_tree_loop_vectorize) > && loop->safelen > 1) > { > loop->force_vect = true; > > similar. > > - if (!opts_set->x_flag_tree_vectorize) > - opts->x_flag_tree_vectorize = value; > + if (!opts_set->x_flag_tree_loop_vectorize) > + opts->x_flag_tree_loop_vectorize = value; > + if (!opts_set->x_flag_tree_slp_vectorize) > + opts->x_flag_tree_slp_vectorize = value; > > similar - if I use -fprofile-use -fno-tree-vecotorize you override this > choice. > This case should be wrapped in if (!opts_set->x_flag_tree_vectorize) > > @item -ftree-vectorize > @opindex ftree-vectorize > +Perform vectorization on trees. This flag enables > @option{-ftree-loop-vectorize} > +and @option{-ftree-slp-vectorize} if neither option is explicitly specified. > > "if neither option is explicitely specified" doesn't correctly document > -ftree-loop-vectorize -ftree-vectorize behavior, no? (-ftree-slp-vectorize > is still enabled here) > > I'm not a native speaker so I cannot suggest a clearer wording here > but maybe just say "if not explicitely specified". > > Ok with the -fprofile-use change I suggested and whatever resolution Jakub > suggests and the doc adjustment. > > Thanks, > Richard. > >> thanks, >> >> David >> >> On Fri, Sep 13, 2013 at 9:48 AM, Xinliang David Li <davi...@google.com> >> wrote: >>> Ok -- then my updated patch is wrong then. The implementation in the >>> first version matches the requirement. >>> >>> thanks, >>> >>> David >>> >>> >>> On Fri, Sep 13, 2013 at 9:45 AM, Joseph S. Myers >>> <jos...@codesourcery.com> wrote: >>>> On Fri, 13 Sep 2013, Richard Biener wrote: >>>> >>>>> @@ -1691,6 +1695,12 @@ common_handle_option (struct gcc_options >>>>> opts->x_flag_ipa_reference = false; >>>>> break; >>>>> >>>>> + case OPT_ftree_vectorize: >>>>> + if (!opts_set->x_flag_tree_loop_vectorize) >>>>> + opts->x_flag_tree_loop_vectorize = value; >>>>> + if (!opts_set->x_flag_tree_slp_vectorize) >>>>> + opts->x_flag_tree_slp_vectorize = value; >>>>> + break; >>>>> >>>>> doesn't look obviously correct. Does that handle >>>> >>>> It looks right to me. The general principle is that the more specific >>>> option takes precedence over the less specific one, whatever the order on >>>> the command line. >>>> >>>>> -ftree-vectorize -fno-tree-loop-vectorize -ftree-vectorize >>>> >>>> Should mean -ftree-slp-vectorize. >>>> >>>>> -ftree-loop-vectorize -fno-tree-vectorize >>>> >>>> Should mean -ftree-loop-vectorize. >>>> >>>>> -ftree-slp-vectorize -fno-tree-vectorize >>>> >>>> Should mean -ftree-slp-vectorize. >>>> >>>> -- >>>> Joseph S. Myers >>>> jos...@codesourcery.com