[COMMITTED,2/3] Add --param=vrp1-mode and --param=vrp2-mode.
Commit Message
This patch adds 2 new --params, vrp1-mode and vrp2-mode. They can be
used to select which version of VRP should be used for each pass. Valid
options are "vrp" and "ranger": ie
--param=vrp1-mode=vrp
--param=vrp2-mode=ranger
As VRP is the current default for both, again, there is no functional
change, but it is now possible to run ranger in either of the 2 VRP
passes. The plan will be to make ranger the default for VRP2 once I've
sorted out a couple of testcases.
Bootstrapped on x86_64-pc-linux-gnu with no regressions. Pushed.
From bd400db6d3ec167142ace352db00f84d382e33a8 Mon Sep 17 00:00:00 2001
From: Andrew MacLeod <amacleod@redhat.com>
Date: Fri, 15 Oct 2021 12:06:27 -0400
Subject: [PATCH 2/3] Add --param=vrp1-mode and --param=vrp2-mode.
Add 2 new params to select between VRP and RANGER to be used for each pass.
* doc/invoke.texi: (vrp1-mode, vrp2-mode): Document.
* flag-types.h: (enum vrp_mode): New.
* params.opt: (vrp1-mode, vrp2-mode): New.
* tree-vrp.c (vrp_pass_num): New.
(pass_vrp::pass_vrp): Set pass number.
(pass_vrp::execute): Choose which VRP mode to execute.
---
gcc/doc/invoke.texi | 6 ++++++
gcc/flag-types.h | 7 +++++++
gcc/params.opt | 17 +++++++++++++++++
gcc/tree-vrp.c | 12 ++++++++++--
4 files changed, 40 insertions(+), 2 deletions(-)
@@ -14504,6 +14504,12 @@ Maximum number of basic blocks before EVRP uses a sparse cache.
@item evrp-mode
Specifies the mode Early VRP should operate in.
+@item vrp1-mode
+Specifies the mode VRP pass 1 should operate in.
+
+@item vrp2-mode
+Specifies the mode VRP pass 2 should operate in.
+
@item evrp-switch-limit
Specifies the maximum number of switch cases before EVRP ignores a switch.
@@ -463,6 +463,13 @@ enum evrp_mode
EVRP_MODE_DEBUG = (EVRP_MODE_GORI | EVRP_MODE_CACHE)
};
+/* VRP modes. */
+enum vrp_mode
+{
+ VRP_MODE_VRP,
+ VRP_MODE_RANGER
+};
+
/* Modes of OpenACC 'kernels' constructs handling. */
enum openacc_kernels
{
@@ -1137,4 +1137,21 @@ Controls how loop vectorizer uses partial vectors. 0 means never, 1 means only
Common Joined UInteger Var(param_vect_inner_loop_cost_factor) Init(50) IntegerRange(1, 10000) Param Optimization
The maximum factor which the loop vectorizer applies to the cost of statements in an inner loop relative to the loop being vectorized.
+-param=vrp1-mode=
+Common Joined Var(param_vrp1_mode) Enum(vrp_mode) Init(VRP_MODE_VRP) Param Optimization
+--param=vrp1-mode=[vrp|ranger] Specifies the mode VRP1 should operate in.
+
+-param=vrp2-mode=
+Common Joined Var(param_vrp2_mode) Enum(vrp_mode) Init(VRP_MODE_VRP) Param Optimization
+--param=vrp2-mode=[vrp|ranger] Specifies the mode VRP2 should operate in.
+
+Enum
+Name(vrp_mode) Type(enum vrp_mode) UnknownError(unknown vrp mode %qs)
+
+EnumValue
+Enum(vrp_mode) String(vrp) Value(VRP_MODE_VRP)
+
+EnumValue
+Enum(vrp_mode) String(ranger) Value(VRP_MODE_RANGER)
+
; This comment is to ensure we retain the blank line above.
@@ -4450,11 +4450,13 @@ const pass_data pass_data_vrp =
( TODO_cleanup_cfg | TODO_update_ssa ), /* todo_flags_finish */
};
+static int vrp_pass_num = 0;
class pass_vrp : public gimple_opt_pass
{
public:
pass_vrp (gcc::context *ctxt)
- : gimple_opt_pass (pass_data_vrp, ctxt), warn_array_bounds_p (false)
+ : gimple_opt_pass (pass_data_vrp, ctxt), warn_array_bounds_p (false),
+ my_pass (++vrp_pass_num)
{}
/* opt_pass methods: */
@@ -4466,10 +4468,16 @@ public:
}
virtual bool gate (function *) { return flag_tree_vrp != 0; }
virtual unsigned int execute (function *fun)
- { return execute_vrp (fun, warn_array_bounds_p); }
+ {
+ if ((my_pass == 1 && param_vrp1_mode == VRP_MODE_RANGER)
+ || (my_pass == 2 && param_vrp2_mode == VRP_MODE_RANGER))
+ return execute_ranger_vrp (fun, warn_array_bounds_p);
+ return execute_vrp (fun, warn_array_bounds_p);
+ }
private:
bool warn_array_bounds_p;
+ int my_pass;
}; // class pass_vrp
} // anon namespace
--
2.17.2