]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Add param for bb limit to invoke fast_vrp.
authorAndrew MacLeod <amacleod@redhat.com>
Mon, 17 Jun 2024 15:38:46 +0000 (11:38 -0400)
committerAndrew MacLeod <amacleod@redhat.com>
Tue, 25 Jun 2024 19:50:49 +0000 (15:50 -0400)
If the basic block count is too high, simply use fast_vrp for all
VRP passes.

* doc/invoke.texi (vrp-block-limit): Document.
* params.opt (param=vrp-block-limit): New.
* tree-vrp.cc (fvrp_folder::execute): Invoke fast_vrp if block
count exceeds limit.

gcc/doc/invoke.texi
gcc/params.opt
gcc/tree-vrp.cc

index 23d90db292590872f9d472877f5b2a2c0be69d5c..729dbc1691ee4a0433e3b7025962c7549bdb647a 100644 (file)
@@ -16849,6 +16849,9 @@ this parameter.  The default value of this parameter is 50.
 @item vect-induction-float
 Enable loop vectorization of floating point inductions.
 
+@item vrp-block-limit
+Maximum number of basic blocks before VRP switches to a lower memory algorithm.
+
 @item vrp-sparse-threshold
 Maximum number of basic blocks before VRP uses a sparse bitmap cache.
 
index d34ef545bf03572422c4afc8dc98b06d45463f9d..c17ba17b91b0be38118863f9aac3a06dd63d20be 100644 (file)
@@ -1198,6 +1198,10 @@ The maximum factor which the loop vectorizer applies to the cost of statements i
 Common Joined UInteger Var(param_vect_induction_float) Init(1) IntegerRange(0, 1) Param Optimization
 Enable loop vectorization of floating point inductions.
 
+-param=vrp-block-limit=
+Common Joined UInteger Var(param_vrp_block_limit) Init(150000) Optimization Param
+Maximum number of basic blocks before VRP switches to a fast model with less memory requirements.
+
 -param=vrp-sparse-threshold=
 Common Joined UInteger Var(param_vrp_sparse_threshold) Init(3000) Optimization Param
 Maximum number of basic blocks before VRP uses a sparse bitmap cache.
index 26979b706e5c7872e9135b96e894448f54acca52..e184e9af51e1925f0d02b8fb891f5047744118ce 100644 (file)
@@ -60,6 +60,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "ipa-cp.h"
 #include "ipa-prop.h"
 #include "attribs.h"
+#include "diagnostic-core.h"
 
 // This class is utilized by VRP and ranger to remove __builtin_unreachable
 // calls, and reflect any resulting global ranges.
@@ -1331,9 +1332,18 @@ public:
   unsigned int execute (function *fun) final override
     {
       // Check for fast vrp.
-      if (&data == &pass_data_fast_vrp)
+      bool use_fvrp = (&data == &pass_data_fast_vrp);
+      if (!use_fvrp && last_basic_block_for_fn (fun) > param_vrp_block_limit)
+       {
+         use_fvrp = true;
+         warning (OPT_Wdisabled_optimization,
+                  "Using fast VRP algorithm. %d basic blocks"
+                  " exceeds %<--param=vrp-block-limit=%d%> limit",
+                  n_basic_blocks_for_fn (fun),
+                  param_vrp_block_limit);
+       }
+      if (use_fvrp)
        return execute_fast_vrp (fun, final_p);
-
       return execute_ranger_vrp (fun, final_p);
     }