diff options
author | Richard Biener <rguenther@suse.de> | 2022-09-02 14:10:40 +0200 |
---|---|---|
committer | Richard Biener <rguenther@suse.de> | 2022-09-02 14:55:53 +0200 |
commit | 805c91843f2f8fc73d17a07d1545cc6ddcbd8935 (patch) | |
tree | f242ed9a2b98a905126d895407a7bf4553fecf6d | |
parent | be1b42de9c151d46c89f9a8f82d4c5839a19ea94 (diff) | |
download | gcc-805c91843f2f8fc73d17a07d1545cc6ddcbd8935.zip gcc-805c91843f2f8fc73d17a07d1545cc6ddcbd8935.tar.gz gcc-805c91843f2f8fc73d17a07d1545cc6ddcbd8935.tar.bz2 |
Refactor RPO VN API to allow timevar tracking
The following refactors things sligtly so "utility" use of the RPO VN
machinery gets its own timevar when invoked from other passes.
* timevar.def (TV_TREE_RPO_VN): New.
* tree-ssa-sccvn.h (do_rpo_vn): Remove one overload.
* tree-ssa-sccvn.cc (do_rpo_vn_1): Rename the worker.
(do_rpo_vn): Unify the public API, track with TV_TREE_RPO_VN.
(pass_fre::execute): Adjust.
* tree-ssa-uninit.cc (execute_early_warn_uninitialized): Adjust.
-rw-r--r-- | gcc/timevar.def | 1 | ||||
-rw-r--r-- | gcc/tree-ssa-sccvn.cc | 28 | ||||
-rw-r--r-- | gcc/tree-ssa-sccvn.h | 8 | ||||
-rw-r--r-- | gcc/tree-ssa-uninit.cc | 5 |
4 files changed, 25 insertions, 17 deletions
diff --git a/gcc/timevar.def b/gcc/timevar.def index 651af19..eac4370 100644 --- a/gcc/timevar.def +++ b/gcc/timevar.def @@ -176,6 +176,7 @@ DEFTIMEVAR (TV_TREE_SPLIT_EDGES , "tree split crit edges") DEFTIMEVAR (TV_TREE_REASSOC , "tree reassociation") DEFTIMEVAR (TV_TREE_PRE , "tree PRE") DEFTIMEVAR (TV_TREE_FRE , "tree FRE") +DEFTIMEVAR (TV_TREE_RPO_VN , "tree RPO VN") DEFTIMEVAR (TV_TREE_SINK , "tree code sinking") DEFTIMEVAR (TV_TREE_PHIOPT , "tree linearize phis") DEFTIMEVAR (TV_TREE_BACKPROP , "tree backward propagate") diff --git a/gcc/tree-ssa-sccvn.cc b/gcc/tree-ssa-sccvn.cc index 5abc866..74b8d8d 100644 --- a/gcc/tree-ssa-sccvn.cc +++ b/gcc/tree-ssa-sccvn.cc @@ -7290,14 +7290,14 @@ eliminate_with_rpo_vn (bitmap inserted_exprs) return walker.eliminate_cleanup (); } -unsigned -do_rpo_vn (function *fn, edge entry, bitmap exit_bbs, - bool iterate, bool eliminate, vn_lookup_kind kind); +static unsigned +do_rpo_vn_1 (function *fn, edge entry, bitmap exit_bbs, + bool iterate, bool eliminate, vn_lookup_kind kind); void run_rpo_vn (vn_lookup_kind kind) { - do_rpo_vn (cfun, NULL, NULL, true, false, kind); + do_rpo_vn_1 (cfun, NULL, NULL, true, false, kind); /* ??? Prune requirement of these. */ constant_to_value_id = new hash_table<vn_constant_hasher> (23); @@ -7995,9 +7995,9 @@ do_unwind (unwind_state *to, rpo_elim &avail) executed and iterate. If ELIMINATE is true then perform elimination, otherwise leave that to the caller. */ -unsigned -do_rpo_vn (function *fn, edge entry, bitmap exit_bbs, - bool iterate, bool eliminate, vn_lookup_kind kind) +static unsigned +do_rpo_vn_1 (function *fn, edge entry, bitmap exit_bbs, + bool iterate, bool eliminate, vn_lookup_kind kind) { unsigned todo = 0; default_vn_walk_kind = kind; @@ -8415,12 +8415,18 @@ do_rpo_vn (function *fn, edge entry, bitmap exit_bbs, /* Region-based entry for RPO VN. Performs value-numbering and elimination on the SEME region specified by ENTRY and EXIT_BBS. If ENTRY is not the only edge into the region at ENTRY->dest PHI nodes in ENTRY->dest - are not considered. */ + are not considered. + If ITERATE is true then treat backedges optimistically as not + executed and iterate. If ELIMINATE is true then perform + elimination, otherwise leave that to the caller. + KIND specifies the amount of work done for handling memory operations. */ unsigned -do_rpo_vn (function *fn, edge entry, bitmap exit_bbs) +do_rpo_vn (function *fn, edge entry, bitmap exit_bbs, + bool iterate, bool eliminate, vn_lookup_kind kind) { - unsigned todo = do_rpo_vn (fn, entry, exit_bbs, false, true, VN_WALKREWRITE); + auto_timevar tv (TV_TREE_RPO_VN); + unsigned todo = do_rpo_vn_1 (fn, entry, exit_bbs, iterate, eliminate, kind); free_rpo_vn (); return todo; } @@ -8476,7 +8482,7 @@ pass_fre::execute (function *fun) if (iterate_p) loop_optimizer_init (AVOID_CFG_MODIFICATIONS); - todo = do_rpo_vn (fun, NULL, NULL, iterate_p, true, VN_WALKREWRITE); + todo = do_rpo_vn_1 (fun, NULL, NULL, iterate_p, true, VN_WALKREWRITE); free_rpo_vn (); if (iterate_p) diff --git a/gcc/tree-ssa-sccvn.h b/gcc/tree-ssa-sccvn.h index a1b1e6b..abcf7e6 100644 --- a/gcc/tree-ssa-sccvn.h +++ b/gcc/tree-ssa-sccvn.h @@ -295,8 +295,12 @@ value_id_constant_p (unsigned int v) tree fully_constant_vn_reference_p (vn_reference_t); tree vn_nary_simplify (vn_nary_op_t); -unsigned do_rpo_vn (function *, edge, bitmap, bool, bool, vn_lookup_kind); -unsigned do_rpo_vn (function *, edge, bitmap); +unsigned do_rpo_vn (function *, edge, bitmap, + /* iterate */ bool = false, + /* eliminate */ bool = true, + vn_lookup_kind = VN_WALKREWRITE); + +/* Private interface for PRE. */ void run_rpo_vn (vn_lookup_kind); unsigned eliminate_with_rpo_vn (bitmap); void free_rpo_vn (void); diff --git a/gcc/tree-ssa-uninit.cc b/gcc/tree-ssa-uninit.cc index c25fbe6..29dc48c 100644 --- a/gcc/tree-ssa-uninit.cc +++ b/gcc/tree-ssa-uninit.cc @@ -1466,10 +1466,7 @@ execute_early_warn_uninitialized (struct function *fun) elimination to compute edge reachability. Don't bother when we only warn for unconditionally executed code though. */ if (!optimize) - { - do_rpo_vn (fun, NULL, NULL, false, false, VN_NOWALK); - free_rpo_vn (); - } + do_rpo_vn (fun, NULL, NULL, false, false, VN_NOWALK); else set_all_edges_as_executable (fun); |