On 22/04/2020 16:25, Jakub Jelinek wrote:
On Wed, Apr 22, 2020 at 04:17:56PM +0200, Philipp Tomsich wrote:
ptomsich@android:~/riscv/gcc/gcc$ git grep OPT_LEVELS_3
common/common-target.h:  OPT_LEVELS_3_PLUS, /* -O3 and above.  */
common/common-target.h:  OPT_LEVELS_3_PLUS_AND_SIZE, /* -O3 and above and -Os.  
*/
common/config/arc/arc-common.c:#define OPT_LEVELS_3_PLUS_SPEED_ONLY 
OPT_LEVELS_3_PLUS
common/config/arc/arc-common.c:    { OPT_LEVELS_3_PLUS_SPEED_ONLY, 
OPT_msize_level_, NULL, 0 },
common/config/arc/arc-common.c:    { OPT_LEVELS_3_PLUS_SPEED_ONLY, 
OPT_malign_call, NULL, 1 },
common/config/nios2/nios2-common.c:    { OPT_LEVELS_3_PLUS, OPT_mfast_sw_div, 
NULL, 1 },
opts.c:    case OPT_LEVELS_3_PLUS:
opts.c:    case OPT_LEVELS_3_PLUS_AND_SIZE:
opts.c:    { OPT_LEVELS_3_PLUS_AND_SIZE, OPT_finline_functions, NULL, 1 },
opts.c:    { OPT_LEVELS_3_PLUS, OPT_fgcse_after_reload, NULL, 1 },
opts.c:    { OPT_LEVELS_3_PLUS, OPT_fipa_cp_clone, NULL, 1 },
opts.c:    { OPT_LEVELS_3_PLUS, OPT_floop_interchange, NULL, 1 },
opts.c:    { OPT_LEVELS_3_PLUS, OPT_floop_unroll_and_jam, NULL, 1 },
opts.c:    { OPT_LEVELS_3_PLUS, OPT_fpeel_loops, NULL, 1 },
opts.c:    { OPT_LEVELS_3_PLUS, OPT_fpredictive_commoning, NULL, 1 },
opts.c:    { OPT_LEVELS_3_PLUS, OPT_fsplit_loops, NULL, 1 },
opts.c:    { OPT_LEVELS_3_PLUS, OPT_fsplit_paths, NULL, 1 },
opts.c:    { OPT_LEVELS_3_PLUS, OPT_ftree_loop_distribute_patterns, NULL, 1 },
opts.c:    { OPT_LEVELS_3_PLUS, OPT_ftree_loop_distribution, NULL, 1 },
opts.c:    { OPT_LEVELS_3_PLUS, OPT_ftree_loop_vectorize, NULL, 1 },
opts.c:    { OPT_LEVELS_3_PLUS, OPT_ftree_partial_pre, NULL, 1 },
opts.c:    { OPT_LEVELS_3_PLUS, OPT_ftree_slp_vectorize, NULL, 1 },
opts.c:    { OPT_LEVELS_3_PLUS, OPT_funswitch_loops, NULL, 1 },
opts.c:    { OPT_LEVELS_3_PLUS, OPT_fvect_cost_model_, NULL, 
VECT_COST_MODEL_DYNAMIC },
opts.c:    { OPT_LEVELS_3_PLUS, OPT_fversion_loops_for_strides, NULL, 1 },

That is not everything, some spots also compare the value of optimize, e.g.
tree-ssa-loop-ivcanon.c:                                                   || 
optimize >= 3, true);
tree-ssa-loop-ivcanon.c:      ret = tree_unroll_loops_completely (optimize >= 
3, false);
tree-ssa-loop-niter.c:  if (optimize >= 3)
An -O? option is not just a set of suboptions it enables, and there are
other option interactions (e.g. some ftree-* etc. options might be set, but
for whatever reason the corresponding pass isn't enabled, e.g. -Og or -O0
have significantly different parts of pass lists and many passes just aren't
schedule at all in those cases).

Hi Jakub,

in order for me to debug my issue, I'm going to have to refactor passes which directly reference optimize. I am planning on refactoring them by creating a "$pass_opt_level". This variable can be set via command line or somewhere in opts.c. I can then substitute the references to optimize with $pass_opt_level.

Would this be worthy of contribution?

        Jakub

Reply via email to