diff options
author | Richard Biener <rguenther@suse.de> | 2016-03-21 09:11:37 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2016-03-21 09:11:37 +0000 |
commit | 56bbfaf62ca1d53c8016e0d9e00394a5f23c047a (patch) | |
tree | 3bc1f9fdebe2a92b99d3cd21c5a25bcbdd36041f /gcc/tree-ssa-loop-ivcanon.c | |
parent | 3eee49ed0d613c47ddfec85eeb7c0430ae6d2ec5 (diff) |
re PR tree-optimization/70288 (ICE with -O1 -fno-tree-dominator-opts)
2016-03-21 Richard Biener <rguenther@suse.de>
PR tree-optimization/70288
* tree-ssa-loop-ivcanon.c (tree_estimate_loop_size): Make sure
we do not estimate unsimplified all-constant conditionals or
switches as optimized away.
* gcc.dg/torture/pr70288-1.c: New testcase.
* gcc.dg/torture/pr70288-2.c: Likewise.
From-SVN: r234361
Diffstat (limited to 'gcc/tree-ssa-loop-ivcanon.c')
-rw-r--r-- | gcc/tree-ssa-loop-ivcanon.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/gcc/tree-ssa-loop-ivcanon.c b/gcc/tree-ssa-loop-ivcanon.c index 1a4d6df7062..72f91b27342 100644 --- a/gcc/tree-ssa-loop-ivcanon.c +++ b/gcc/tree-ssa-loop-ivcanon.c @@ -298,11 +298,17 @@ tree_estimate_loop_size (struct loop *loop, edge exit, edge edge_to_cancel, stru /* Conditionals. */ else if ((gimple_code (stmt) == GIMPLE_COND && constant_after_peeling (gimple_cond_lhs (stmt), stmt, loop) - && constant_after_peeling (gimple_cond_rhs (stmt), stmt, loop)) + && constant_after_peeling (gimple_cond_rhs (stmt), stmt, loop) + /* We don't simplify all constant compares so make sure + they are not both constant already. See PR70288. */ + && (! is_gimple_min_invariant (gimple_cond_lhs (stmt)) + || ! is_gimple_min_invariant (gimple_cond_rhs (stmt)))) || (gimple_code (stmt) == GIMPLE_SWITCH && constant_after_peeling (gimple_switch_index ( as_a <gswitch *> (stmt)), - stmt, loop))) + stmt, loop) + && ! is_gimple_min_invariant (gimple_switch_index ( + as_a <gswitch *> (stmt))))) { if (dump_file && (dump_flags & TDF_DETAILS)) fprintf (dump_file, " Constant conditional.\n"); |