diff options
author | Richard Biener <rguenther@suse.de> | 2017-03-02 07:53:42 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2017-03-02 07:53:42 +0000 |
commit | 83692f96622d65acd462df4cea225b7bc2827d80 (patch) | |
tree | bd874e6e28c52071e34efd25584d4f63a0a4dbd0 /gcc/tree-ssa-pre.c | |
parent | d34d36ef0d85c74884f8f8b0c80d845d3d1bc04f (diff) | |
download | gcc-83692f96622d65acd462df4cea225b7bc2827d80.zip gcc-83692f96622d65acd462df4cea225b7bc2827d80.tar.gz gcc-83692f96622d65acd462df4cea225b7bc2827d80.tar.bz2 |
re PR tree-optimization/79777 (ICE on -Os and above in on aarch64-linux-gnu (internal compiler error: in VN_INFO_GET, at tree-ssa-sccvn.c:407 }))
2017-03-02 Richard Biener <rguenther@suse.de>
PR tree-optimization/79777
* tree-ssa-pre.c (eliminate_insert): Give up if we simplify
the to insert expression to sth existing.
* gcc.dg/torture/pr79777.c: New testcase.
From-SVN: r245830
Diffstat (limited to 'gcc/tree-ssa-pre.c')
-rw-r--r-- | gcc/tree-ssa-pre.c | 39 |
1 files changed, 35 insertions, 4 deletions
diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c index bdf48ad7..ff59d53 100644 --- a/gcc/tree-ssa-pre.c +++ b/gcc/tree-ssa-pre.c @@ -4133,11 +4133,42 @@ eliminate_insert (gimple_stmt_iterator *gsi, tree val) else res = gimple_build (&stmts, gimple_assign_rhs_code (stmt), TREE_TYPE (val), leader); - gsi_insert_seq_before (gsi, stmts, GSI_SAME_STMT); - VN_INFO_GET (res)->valnum = val; + if (TREE_CODE (res) != SSA_NAME + || SSA_NAME_IS_DEFAULT_DEF (res) + || gimple_bb (SSA_NAME_DEF_STMT (res))) + { + gimple_seq_discard (stmts); + + /* During propagation we have to treat SSA info conservatively + and thus we can end up simplifying the inserted expression + at elimination time to sth not defined in stmts. */ + /* But then this is a redundancy we failed to detect. Which means + res now has two values. That doesn't play well with how + we track availability here, so give up. */ + if (dump_file && (dump_flags & TDF_DETAILS)) + { + if (TREE_CODE (res) == SSA_NAME) + res = eliminate_avail (res); + if (res) + { + fprintf (dump_file, "Failed to insert expression for value "); + print_generic_expr (dump_file, val, 0); + fprintf (dump_file, " which is really fully redundant to "); + print_generic_expr (dump_file, res, 0); + fprintf (dump_file, "\n"); + } + } - if (TREE_CODE (leader) == SSA_NAME) - gimple_set_plf (SSA_NAME_DEF_STMT (leader), NECESSARY, true); + return NULL_TREE; + } + else + { + gsi_insert_seq_before (gsi, stmts, GSI_SAME_STMT); + VN_INFO_GET (res)->valnum = val; + + if (TREE_CODE (leader) == SSA_NAME) + gimple_set_plf (SSA_NAME_DEF_STMT (leader), NECESSARY, true); + } pre_stats.insertions++; if (dump_file && (dump_flags & TDF_DETAILS)) |