diff options
author | Richard Biener <rguenther@suse.de> | 2017-03-28 13:57:43 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2017-03-28 13:57:43 +0000 |
commit | ea7d7da886911a91831bd45fc56d0aa1e2a55ecc (patch) | |
tree | 32c6fd2b62e696ad32a428181f47685729b004a6 /gcc/tree-ssa-ccp.c | |
parent | 498173ef330d33ca0df09bfc3481de6d56cfa64c (diff) | |
download | gcc-ea7d7da886911a91831bd45fc56d0aa1e2a55ecc.zip gcc-ea7d7da886911a91831bd45fc56d0aa1e2a55ecc.tar.gz gcc-ea7d7da886911a91831bd45fc56d0aa1e2a55ecc.tar.bz2 |
re PR ipa/78644 (ICE: SIGSEGV in is_gimple_reg_type with -Og -fipa-cp)
2017-03-28 Richard Biener <rguenther@suse.de>
PR tree-optimization/78644
* tree-ssa-ccp.c (evaluate_stmt): When we may not use the value
of a simplification result we may not use it at all.
* gcc.dg/pr78644-1.c: New testcase.
* gcc.dg/pr78644-2.c: Likewise.
From-SVN: r246534
Diffstat (limited to 'gcc/tree-ssa-ccp.c')
-rw-r--r-- | gcc/tree-ssa-ccp.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c index 023018c..23f2adcb 100644 --- a/gcc/tree-ssa-ccp.c +++ b/gcc/tree-ssa-ccp.c @@ -1749,18 +1749,24 @@ evaluate_stmt (gimple *stmt) fold_defer_overflow_warnings (); simplified = ccp_fold (stmt); if (simplified - && TREE_CODE (simplified) == SSA_NAME + && TREE_CODE (simplified) == SSA_NAME) + { /* We may not use values of something that may be simulated again, see valueize_op_1. */ - && (SSA_NAME_IS_DEFAULT_DEF (simplified) - || ! prop_simulate_again_p (SSA_NAME_DEF_STMT (simplified)))) - { - ccp_prop_value_t *val = get_value (simplified); - if (val && val->lattice_val != VARYING) + if (SSA_NAME_IS_DEFAULT_DEF (simplified) + || ! prop_simulate_again_p (SSA_NAME_DEF_STMT (simplified))) { - fold_undefer_overflow_warnings (true, stmt, 0); - return *val; + ccp_prop_value_t *val = get_value (simplified); + if (val && val->lattice_val != VARYING) + { + fold_undefer_overflow_warnings (true, stmt, 0); + return *val; + } } + else + /* We may also not place a non-valueized copy in the lattice + as that might become stale if we never re-visit this stmt. */ + simplified = NULL_TREE; } is_constant = simplified && is_gimple_min_invariant (simplified); fold_undefer_overflow_warnings (is_constant, stmt, 0); |