From a6377d52d749327d8e7b8b4d2e51bb873da24ad9 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Mon, 5 Jan 2015 19:53:44 +0100 Subject: [PATCH] re PR tree-optimization/64494 (ICE at -Os and above on x86_64-linux-gnu in duplicate_ssa_name_range_info, at tree-ssanames.c:499) PR tree-optimization/64494 * tree-ssa-loop-im.c (move_computations_dom_walker::before_dom): Also clear SSA_NAME_ANTI_RANGE_P flag. * gcc.c-torture/compile/pr64494.c: New test. From-SVN: r219194 --- gcc/ChangeLog | 6 ++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.c-torture/compile/pr64494.c | 18 ++++++++++++++++++ gcc/tree-ssa-loop-im.c | 12 ++++++++++-- 4 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr64494.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e418275b992..2ba1d2bdcf6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2015-01-05 Jakub Jelinek + + PR tree-optimization/64494 + * tree-ssa-loop-im.c (move_computations_dom_walker::before_dom): Also + clear SSA_NAME_ANTI_RANGE_P flag. + 2015-01-05 Marek Polacek * doc/extend.texi (Arrays of Length Zero): Add missing comma. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ee90726c331..90c25a5c285 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-01-05 Jakub Jelinek + + PR tree-optimization/64494 + * gcc.c-torture/compile/pr64494.c: New test. + 2015-01-05 Thomas Koenig PR fortran/47674 diff --git a/gcc/testsuite/gcc.c-torture/compile/pr64494.c b/gcc/testsuite/gcc.c-torture/compile/pr64494.c new file mode 100644 index 00000000000..f6718d341cc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr64494.c @@ -0,0 +1,18 @@ +/* PR tree-optimization/64494 */ + +int a, b; +unsigned char c; + +int +main () +{ + int d; + a = 0; + for (d = 0; d < 2; d++) + { + a &= (b >= 1); + c = (204 > (((unsigned char) ~0) >> a)) ? 0 : 204 << a; + b = 0; + } + return 0; +} diff --git a/gcc/tree-ssa-loop-im.c b/gcc/tree-ssa-loop-im.c index a442146bece..6319eff7a7c 100644 --- a/gcc/tree-ssa-loop-im.c +++ b/gcc/tree-ssa-loop-im.c @@ -1236,7 +1236,11 @@ move_computations_dom_walker::before_dom_children (basic_block bb) && (!ALWAYS_EXECUTED_IN (bb) || (ALWAYS_EXECUTED_IN (bb) != level && !flow_loop_nested_p (ALWAYS_EXECUTED_IN (bb), level)))) - SSA_NAME_RANGE_INFO (gimple_assign_lhs (new_stmt)) = NULL; + { + tree lhs = gimple_assign_lhs (new_stmt); + SSA_NAME_RANGE_INFO (lhs) = NULL; + SSA_NAME_ANTI_RANGE_P (lhs) = 0; + } gsi_insert_on_edge (loop_preheader_edge (level), new_stmt); remove_phi_node (&bsi, false); } @@ -1302,7 +1306,11 @@ move_computations_dom_walker::before_dom_children (basic_block bb) && (!ALWAYS_EXECUTED_IN (bb) || !(ALWAYS_EXECUTED_IN (bb) == level || flow_loop_nested_p (ALWAYS_EXECUTED_IN (bb), level)))) - SSA_NAME_RANGE_INFO (gimple_get_lhs (stmt)) = NULL; + { + tree lhs = gimple_get_lhs (stmt); + SSA_NAME_RANGE_INFO (lhs) = NULL; + SSA_NAME_ANTI_RANGE_P (lhs) = 0; + } /* In case this is a stmt that is not unconditionally executed when the target loop header is executed and the stmt may invoke undefined integer or pointer overflow rewrite it to -- 2.30.2