diff options
author | Richard Biener <rguenther@suse.de> | 2015-07-06 14:41:22 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2015-07-06 14:41:22 +0000 |
commit | 1a02f6c118f7e572208ef717f785d78e112f7f6b (patch) | |
tree | 8a0f6f699215e47e3df794c0f8c1e8b5155409b0 /gcc/tree-ssa-ccp.c | |
parent | fe55a82362706dc6453e7d9af16b3cbe8e0e9922 (diff) | |
download | gcc-1a02f6c118f7e572208ef717f785d78e112f7f6b.zip gcc-1a02f6c118f7e572208ef717f785d78e112f7f6b.tar.gz gcc-1a02f6c118f7e572208ef717f785d78e112f7f6b.tar.bz2 |
re PR tree-optimization/66772 (ICE at -O2 and -O3 on x86_64-linux-gnu)
2015-07-06 Richard Biener <rguenther@suse.de>
PR tree-optimization/66772
* tree-ssa-ccp.c (ccp_visit_phi_node): Make sure that copy
values are available in the PHI node BB when there are
still unexecutable edges.
* gcc.dg/torture/pr66772-1.c: New testcase.
* gcc.dg/torture/pr66772-2.c: Likewise.
From-SVN: r225459
Diffstat (limited to 'gcc/tree-ssa-ccp.c')
-rw-r--r-- | gcc/tree-ssa-ccp.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c index 496d840..05a3e57 100644 --- a/gcc/tree-ssa-ccp.c +++ b/gcc/tree-ssa-ccp.c @@ -1081,6 +1081,7 @@ ccp_visit_phi_node (gphi *phi) new_val.mask = 0; bool first = true; + bool non_exec_edge = false; for (i = 0; i < gimple_phi_num_args (phi); i++) { /* Compute the meet operator over all the PHI arguments flowing @@ -1121,6 +1122,22 @@ ccp_visit_phi_node (gphi *phi) if (new_val.lattice_val == VARYING) break; } + else + non_exec_edge = true; + } + + /* In case there were non-executable edges and the value is a copy + make sure its definition dominates the PHI node. */ + if (non_exec_edge + && new_val.lattice_val == CONSTANT + && TREE_CODE (new_val.value) == SSA_NAME + && ! SSA_NAME_IS_DEFAULT_DEF (new_val.value) + && ! dominated_by_p (CDI_DOMINATORS, gimple_bb (phi), + gimple_bb (SSA_NAME_DEF_STMT (new_val.value)))) + { + new_val.lattice_val = VARYING; + new_val.value = NULL_TREE; + new_val.mask = -1; } if (dump_file && (dump_flags & TDF_DETAILS)) |