From: Martin Liska Date: Mon, 25 Oct 2021 14:54:22 +0000 (+0200) Subject: Fix negative integer range for UInteger. X-Git-Tag: basepoints/gcc-13~3481 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=679652a77da60078392a834ed4b6b910127dbf24;p=thirdparty%2Fgcc.git Fix negative integer range for UInteger. gcc/ChangeLog: * opt-functions.awk: Add new sanity checking. * optc-gen.awk: Add new argument to integer_range_info. * params.opt: Update 2 params which have negative IntegerRange. --- diff --git a/gcc/opt-functions.awk b/gcc/opt-functions.awk index be9255064d76..9bc856040669 100644 --- a/gcc/opt-functions.awk +++ b/gcc/opt-functions.awk @@ -356,7 +356,7 @@ function search_var_name(name, opt_numbers, opts, flags, n_opts) return "" } -function integer_range_info(range_option, init, option) +function integer_range_info(range_option, init, option, uinteger_used) { if (range_option != "") { ival = init + 0; @@ -364,6 +364,8 @@ function integer_range_info(range_option, init, option) end = nth_arg(1, range_option) + 0; if (init != "" && init != "-1" && (ival < start || ival > end)) print "#error initial value " init " of '" option "' must be in range [" start "," end "]" + if (uinteger_used && start < 0) + print "#error '" option"': negative IntegerRange (" start ", " end ") cannot be combined with UInteger" return start ", " end } else diff --git a/gcc/optc-gen.awk b/gcc/optc-gen.awk index 77e598efd605..ebc1a02fa366 100644 --- a/gcc/optc-gen.awk +++ b/gcc/optc-gen.awk @@ -422,7 +422,7 @@ for (i = 0; i < n_opts; i++) { cl_flags, cl_bit_fields) printf(" %s, %s, %s }%s\n", var_ref(opts[i], flags[i]), var_set(flags[i]), integer_range_info(opt_args("IntegerRange", flags[i]), - opt_args("Init", flags[i]), opts[i]), comma) + opt_args("Init", flags[i]), opts[i], flag_set_p("UInteger", flags[i])), comma) # Bump up the informational option index. ++optindex diff --git a/gcc/params.opt b/gcc/params.opt index 7ee7820f11f9..8c5948f7a84d 100644 --- a/gcc/params.opt +++ b/gcc/params.opt @@ -402,7 +402,7 @@ Common Joined UInteger Var(param_lim_expensive) Init(20) Param Optimization The minimum cost of an expensive expression in the loop invariant motion. -param=logical-op-non-short-circuit= -Common Joined UInteger Var(param_logical_op_non_short_circuit) Init(-1) IntegerRange(-1, 1) Param +Common Joined UInteger Var(param_logical_op_non_short_circuit) Init(-1) IntegerRange(0, 1) Param True if a non-short-circuit operation is optimal. -param=loop-block-tile-size= @@ -1132,7 +1132,7 @@ Common Joined UInteger Var(param_vect_epilogues_nomask) Init(1) IntegerRange(0, Enable loop epilogue vectorization using smaller vector size. -param=vect-max-peeling-for-alignment= -Common Joined UInteger Var(param_vect_max_peeling_for_alignment) Init(-1) IntegerRange(-1, 64) Param Optimization +Common Joined UInteger Var(param_vect_max_peeling_for_alignment) Init(-1) IntegerRange(0, 64) Param Optimization Maximum number of loop peels to enhance alignment of data references in a loop. -param=vect-max-version-for-alias-checks=