]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Fix negative integer range for UInteger.
authorMartin Liska <mliska@suse.cz>
Mon, 25 Oct 2021 14:54:22 +0000 (16:54 +0200)
committerMartin Liska <mliska@suse.cz>
Mon, 1 Nov 2021 19:29:19 +0000 (20:29 +0100)
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.

gcc/opt-functions.awk
gcc/optc-gen.awk
gcc/params.opt

index be9255064d76ca4c8f48a9c9b493b3ef5588e5ff..9bc856040669e901ea04d8efe1a76b64ae74725c 100644 (file)
@@ -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
index 77e598efd605d03e3b6f35671f00e78c78317250..ebc1a02fa36692a30e960350d620e50fcb050286 100644 (file)
@@ -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
index 7ee7820f11f973e78b328bf922525accd9c2dbd1..8c5948f7a84d768969773573cb99179e445cb66b 100644 (file)
@@ -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=