diff options
author | Richard Biener <rguenther@suse.de> | 2023-12-13 08:45:58 +0100 |
---|---|---|
committer | Richard Biener <rguenther@suse.de> | 2023-12-13 09:43:10 +0100 |
commit | 93db32a4146afd2a6d90410691351a56768167c9 (patch) | |
tree | fac4369cfe531d328c3d8d080b79e250e5f38ce8 /gcc/tree-if-conv.cc | |
parent | b9baead90d74e9211fc94d655ecd5d3af3858158 (diff) | |
download | gcc-93db32a4146afd2a6d90410691351a56768167c9.zip gcc-93db32a4146afd2a6d90410691351a56768167c9.tar.gz gcc-93db32a4146afd2a6d90410691351a56768167c9.tar.bz2 |
tree-optimization/112991 - re-do PR112961 fix
The following does away with the fake edge adding as in the original
PR112961 fix and instead exposes handling of entry PHIs as additional
parameter of the region VN run.
PR tree-optimization/112991
PR tree-optimization/112961
* tree-ssa-sccvn.h (do_rpo_vn): Add skip_entry_phis argument.
* tree-ssa-sccvn.cc (do_rpo_vn): Likewise.
(do_rpo_vn_1): Likewise, merge with auto-processing.
(run_rpo_vn): Adjust.
(pass_fre::execute): Likewise.
* tree-if-conv.cc (tree_if_conversion): Revert last change.
Value-number latch block but disable value-numbering of
entry PHIs.
* tree-ssa-uninit.cc (execute_early_warn_uninitialized): Adjust.
* gcc.dg/torture/pr112991.c: New testcase.
Diffstat (limited to 'gcc/tree-if-conv.cc')
-rw-r--r-- | gcc/tree-if-conv.cc | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/gcc/tree-if-conv.cc b/gcc/tree-if-conv.cc index f9fd014..e169413 100644 --- a/gcc/tree-if-conv.cc +++ b/gcc/tree-if-conv.cc @@ -3734,7 +3734,7 @@ tree_if_conversion (class loop *loop, vec<gimple *> *preds) auto_vec <gassign *, 4> reads_to_lower; auto_vec <gassign *, 4> writes_to_lower; bitmap exit_bbs; - edge pe, e; + edge pe; auto_vec<data_reference_p, 10> refs; bool loop_versioned; @@ -3891,27 +3891,21 @@ tree_if_conversion (class loop *loop, vec<gimple *> *preds) combine_blocks (loop, loop_versioned); } + std::pair <tree, tree> *name_pair; + unsigned ssa_names_idx; + FOR_EACH_VEC_ELT (redundant_ssa_names, ssa_names_idx, name_pair) + replace_uses_by (name_pair->first, name_pair->second); + redundant_ssa_names.release (); + /* Perform local CSE, this esp. helps the vectorizer analysis if loads and stores are involved. CSE only the loop body, not the entry PHIs, those are to be kept in sync with the non-if-converted copy. - Do this by adding a fake entry edge - we do want to include the - latch as otherwise copies on a reduction path cannot be propagated out. ??? We'll still keep dead stores though. */ - e = make_edge (ENTRY_BLOCK_PTR_FOR_FN (cfun), loop->header, EDGE_FAKE); exit_bbs = BITMAP_ALLOC (NULL); for (edge exit : get_loop_exit_edges (loop)) bitmap_set_bit (exit_bbs, exit->dest->index); - - std::pair <tree, tree> *name_pair; - unsigned ssa_names_idx; - FOR_EACH_VEC_ELT (redundant_ssa_names, ssa_names_idx, name_pair) - replace_uses_by (name_pair->first, name_pair->second); - redundant_ssa_names.release (); - - todo |= do_rpo_vn (cfun, loop_preheader_edge (loop), exit_bbs); - - /* Remove the fake edge again. */ - remove_edge (e); + todo |= do_rpo_vn (cfun, loop_preheader_edge (loop), exit_bbs, + false, true, true); /* Delete dead predicate computations. */ ifcvt_local_dce (loop); |