diff options
author | Mariam Arutunian <mariamarutunian@gmail.com> | 2024-11-11 12:59:04 -0700 |
---|---|---|
committer | Jeff Law <jlaw@ventanamicro.com> | 2024-12-01 08:54:21 -0700 |
commit | 062ad209e496a69925b1ac1d80d9b99c54801830 (patch) | |
tree | 8eac0e1b0dd7fe0f5a6a55b5bc0a3b4123a89526 /gcc/opts.cc | |
parent | 75fe4e2932136c3814e7ba9a2620d395d8f18133 (diff) | |
download | gcc-062ad209e496a69925b1ac1d80d9b99c54801830.zip gcc-062ad209e496a69925b1ac1d80d9b99c54801830.tar.gz gcc-062ad209e496a69925b1ac1d80d9b99c54801830.tar.bz2 |
[PATCH v7 08/12] Add a new pass for naive CRC loops detection
This patch adds a new compiler pass aimed at identifying naive CRC
implementations, characterized by the presence of a loop calculating
a CRC (polynomial long division). Upon detection of a potential CRC,
the pass prints an informational message.
Performs CRC optimization if optimization level is >= 2 and if
fno_gimple_crc_optimization given.
This pass is added for the detection and optimization of naive CRC
implementations, improving the efficiency of CRC-related computations.
This patch includes only initial fast checks for filtering out non-CRCs,
detected possible CRCs verification and optimization parts will be
provided in subsequent patches.
gcc/
* Makefile.in (OBJS): Add gimple-crc-optimization.o.
* common.opt (foptimize-crc): New option.
* common.opt.urls: Regenerate to add foptimize-crc.
* doc/invoke.texi (-foptimize-crc): Add documentation.
* gimple-crc-optimization.cc: New file.
* opts.cc (default_options_table): Add OPT_foptimize_crc.
(enable_fdo_optimizations): Enable optimize_crc.
* passes.def (pass_crc_optimization): Add new pass.
* timevar.def (TV_GIMPLE_CRC_OPTIMIZATION): New timevar.
* tree-pass.h (make_pass_crc_optimization): New extern function
declaration.
Diffstat (limited to 'gcc/opts.cc')
-rw-r--r-- | gcc/opts.cc | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/gcc/opts.cc b/gcc/opts.cc index 826a822..9909d4a 100644 --- a/gcc/opts.cc +++ b/gcc/opts.cc @@ -668,6 +668,7 @@ static const struct default_options default_options_table[] = VECT_COST_MODEL_VERY_CHEAP }, { OPT_LEVELS_2_PLUS, OPT_finline_functions, NULL, 1 }, { OPT_LEVELS_2_PLUS, OPT_ftree_loop_distribute_patterns, NULL, 1 }, + { OPT_LEVELS_2_PLUS, OPT_foptimize_crc, NULL, 1 }, { OPT_LEVELS_2_PLUS, OPT_flate_combine_instructions, NULL, 1 }, /* -O2 and above optimizations, but not -Os or -Og. */ @@ -2099,6 +2100,7 @@ enable_fdo_optimizations (struct gcc_options *opts, SET_OPTION_IF_UNSET (opts, opts_set, flag_loop_interchange, value); SET_OPTION_IF_UNSET (opts, opts_set, flag_unroll_jam, value); SET_OPTION_IF_UNSET (opts, opts_set, flag_tree_loop_distribution, value); + SET_OPTION_IF_UNSET (opts, opts_set, flag_optimize_crc, value); } /* -f{,no-}sanitize{,-recover}= suboptions. */ |