From 5c7ec4f0d5730d28451003ab8304b388f42f2a85 Mon Sep 17 00:00:00 2001 From: Richard Guenther Date: Thu, 26 Apr 2007 15:28:14 +0000 Subject: [PATCH] re PR tree-optimization/31703 (Gcc 4.3 revision 124101 failed to compile gcc 3.2) 2007-04-26 Richard Guenther PR tree-optimization/31703 * tree-ssa-loop-im.c (rewrite_bittest): Make sure to use the right type for the target of the bittest. * gcc.c-torture/compile/pr31703.c: New testcase. * gcc.dg/tree-ssa/ssa-lim-1.c: Adjust pattern. * gcc.dg/tree-ssa/ssa-lim-2.c: Likewise. From-SVN: r124190 --- gcc/ChangeLog | 6 ++++++ gcc/testsuite/ChangeLog | 7 +++++++ gcc/testsuite/gcc.c-torture/compile/pr31703.c | 11 +++++++++++ gcc/testsuite/gcc.dg/tree-ssa/ssa-lim-1.c | 2 +- gcc/testsuite/gcc.dg/tree-ssa/ssa-lim-2.c | 2 +- gcc/tree-ssa-loop-im.c | 14 ++++++++------ 6 files changed, 34 insertions(+), 8 deletions(-) create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr31703.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9e27031777d7..5e7988d67456 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2007-04-26 Richard Guenther + + PR tree-optimization/31703 + * tree-ssa-loop-im.c (rewrite_bittest): Make sure to use + the right type for the target of the bittest. + 2007-04-26 Richard Sandiford * config/i386/vx-common.h (RETURN_IN_MEMORY): Use diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4310a1cf9d36..b2db604b467e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2007-04-26 Richard Guenther + + PR tree-optimization/31703 + * gcc.c-torture/compile/pr31703.c: New testcase. + * gcc.dg/tree-ssa/ssa-lim-1.c: Adjust pattern. + * gcc.dg/tree-ssa/ssa-lim-2.c: Likewise. + 2007-04-26 Wolfgang Gellerich * gfortran.dg/open_errors.f90: Added if statements checking diff --git a/gcc/testsuite/gcc.c-torture/compile/pr31703.c b/gcc/testsuite/gcc.c-torture/compile/pr31703.c new file mode 100644 index 000000000000..e463205a23b1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr31703.c @@ -0,0 +1,11 @@ +typedef unsigned long long HARD_REG_ELT_TYPE; +static HARD_REG_ELT_TYPE reload_reg_used_in_output_addr[30]; +int reload_reg_reaches_end_p (unsigned int regno, int opnum) +{ + int i; + for (i = opnum + 1; i < opnum; i++) + if (reload_reg_used_in_output_addr[i] + & ((HARD_REG_ELT_TYPE)1 << regno)) + return 0; +} + diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-lim-1.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-lim-1.c index f76c5d492ceb..db36ff02cb2c 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-lim-1.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-lim-1.c @@ -18,5 +18,5 @@ quantum_toffoli (int control1, int control2, int target, } } -/* { dg-final { scan-tree-dump-times "shifttmp" 6 "lim" } } */ +/* { dg-final { scan-tree-dump-times "1 <<" 3 "lim" } } */ /* { dg-final { cleanup-tree-dump "lim" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-lim-2.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-lim-2.c index 286e0e85af62..7b18b1c05505 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-lim-2.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-lim-2.c @@ -18,5 +18,5 @@ int size) } } -/* { dg-final { scan-tree-dump-times "shifttmp" 6 "lim" } } */ +/* { dg-final { scan-tree-dump-times "1 <<" 3 "lim" } } */ /* { dg-final { cleanup-tree-dump "lim" } } */ diff --git a/gcc/tree-ssa-loop-im.c b/gcc/tree-ssa-loop-im.c index 340e6a1aef4c..1e36fae96bd7 100644 --- a/gcc/tree-ssa-loop-im.c +++ b/gcc/tree-ssa-loop-im.c @@ -618,7 +618,7 @@ rewrite_reciprocal (block_stmt_iterator *bsi) static tree rewrite_bittest (block_stmt_iterator *bsi) { - tree stmt, lhs, rhs, var, name, stmt1, stmt2, t; + tree stmt, lhs, rhs, var, name, use_stmt, stmt1, stmt2, t; use_operand_p use; stmt = bsi_stmt (*bsi); @@ -627,10 +627,10 @@ rewrite_bittest (block_stmt_iterator *bsi) /* Verify that the single use of lhs is a comparison against zero. */ if (TREE_CODE (lhs) != SSA_NAME - || !single_imm_use (lhs, &use, &stmt1) - || TREE_CODE (stmt1) != COND_EXPR) + || !single_imm_use (lhs, &use, &use_stmt) + || TREE_CODE (use_stmt) != COND_EXPR) return stmt; - t = COND_EXPR_COND (stmt1); + t = COND_EXPR_COND (use_stmt); if (TREE_OPERAND (t, 0) != lhs || (TREE_CODE (t) != NE_EXPR && TREE_CODE (t) != EQ_EXPR) @@ -680,11 +680,13 @@ rewrite_bittest (block_stmt_iterator *bsi) /* A & (1 << B) */ t = fold_build2 (BIT_AND_EXPR, TREE_TYPE (a), a, name); - stmt2 = build_gimple_modify_stmt (lhs, t); + stmt2 = build_gimple_modify_stmt (var, t); + name = make_ssa_name (var, stmt2); + GIMPLE_STMT_OPERAND (stmt2, 0) = name; + SET_USE (use, name); bsi_insert_before (bsi, stmt1, BSI_SAME_STMT); bsi_replace (bsi, stmt2, true); - SSA_NAME_DEF_STMT (lhs) = stmt2; return stmt1; }