diff options
author | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-05-11 12:53:43 +0000 |
---|---|---|
committer | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-05-11 12:53:43 +0000 |
commit | 8ebd8f29e96a1b18c27d84866b0b28ac0b344dea (patch) | |
tree | e56042c0e2d22f04c029f1f376845c9c63d30b83 | |
parent | 564cba5f5310fd500b946ba26f9e24dae478d3c8 (diff) | |
download | gcc-8ebd8f29e96a1b18c27d84866b0b28ac0b344dea.tar.gz |
PR debug/48159
* tree-ssa.c (reset_debug_uses): New function.
* tree-flow.h (reset_debug_uses): New prototype.
* tree-data-ref.c (stmts_from_loop): Ignore debug stmts.
* tree-loop-distribution.c (generate_loops_for_partition): Call
reset_debug_uses on the stmts that will be removed. Keep around
all debug stmts, don't count them as bits in partition bitmap.
(generate_builtin): Don't count debug stmts or labels as bits in
partition bitmap.
* gcc.dg/pr48159-1.c: New test.
* gcc.dg/pr48159-2.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@173656 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 12 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr48159-1.c | 10 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr48159-2.c | 22 | ||||
-rw-r--r-- | gcc/tree-data-ref.c | 4 | ||||
-rw-r--r-- | gcc/tree-flow.h | 1 | ||||
-rw-r--r-- | gcc/tree-loop-distribution.c | 28 | ||||
-rw-r--r-- | gcc/tree-ssa.c | 31 |
8 files changed, 109 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5b7408b3fff..1c6083581a1 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,15 @@ +2011-05-11 Jakub Jelinek <jakub@redhat.com> + + PR debug/48159 + * tree-ssa.c (reset_debug_uses): New function. + * tree-flow.h (reset_debug_uses): New prototype. + * tree-data-ref.c (stmts_from_loop): Ignore debug stmts. + * tree-loop-distribution.c (generate_loops_for_partition): Call + reset_debug_uses on the stmts that will be removed. Keep around + all debug stmts, don't count them as bits in partition bitmap. + (generate_builtin): Don't count debug stmts or labels as bits in + partition bitmap. + 2011-05-11 Richard Guenther <rguenther@suse.de> * gimple.c (gimple_type_hash_1): Merge with ... diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 5cfb9f23c6c..5fde36e00a3 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2011-05-11 Jakub Jelinek <jakub@redhat.com> + + PR debug/48159 + * gcc.dg/pr48159-1.c: New test. + * gcc.dg/pr48159-2.c: New test. + 2011-05-11 Richard Guenther <rguenther@suse.de> PR middle-end/48953 diff --git a/gcc/testsuite/gcc.dg/pr48159-1.c b/gcc/testsuite/gcc.dg/pr48159-1.c new file mode 100644 index 00000000000..cd67e63852f --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr48159-1.c @@ -0,0 +1,10 @@ +/* PR debug/48159 */ +/* { dg-do compile } */ +/* { dg-options "-O3 -fcompare-debug" } */ + +void +foo (double x, int y, double *__restrict z, double *__restrict w) +{ + while (y--) + *z++ = (*w++ = 0) * x; +} diff --git a/gcc/testsuite/gcc.dg/pr48159-2.c b/gcc/testsuite/gcc.dg/pr48159-2.c new file mode 100644 index 00000000000..25596bf6b39 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr48159-2.c @@ -0,0 +1,22 @@ +/* PR debug/48159 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -ftree-loop-distribution -fcompare-debug" } */ + +int foo (int * __restrict__ ia, int * __restrict__ ib, + int * __restrict__ oxa, int * __restrict__ oxb) +{ + int i; + int oya[52], oyb[52]; + for (i = 0; i < 52; i++) + { + int w1 = ia[i]; + int w2 = oxa[i]; + int w3 = ib[i]; + int w4 = oxb[i]; + int w5 = w1 + w2 + 5; + oya[i] = (w1 * w2) >> 10; + int w6 = w3 + w4 + 6; + oyb[i] = (w3 * w4) >> 10; + } + return oya[22] + oyb[21]; +} diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c index d2d469fea66..7b28b8d9914 100644 --- a/gcc/tree-data-ref.c +++ b/gcc/tree-data-ref.c @@ -1,5 +1,5 @@ /* Data references and dependences detectors. - Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 + Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. Contributed by Sebastian Pop <pop@cri.ensmp.fr> @@ -5017,7 +5017,7 @@ stmts_from_loop (struct loop *loop, VEC (gimple, heap) **stmts) for (bsi = gsi_start_bb (bb); !gsi_end_p (bsi); gsi_next (&bsi)) { stmt = gsi_stmt (bsi); - if (gimple_code (stmt) != GIMPLE_LABEL) + if (gimple_code (stmt) != GIMPLE_LABEL && !is_gimple_debug (stmt)) VEC_safe_push (gimple, heap, *stmts, stmt); } } diff --git a/gcc/tree-flow.h b/gcc/tree-flow.h index adae4630b01..ab5c80cdde0 100644 --- a/gcc/tree-flow.h +++ b/gcc/tree-flow.h @@ -554,6 +554,7 @@ extern void walk_use_def_chains (tree, walk_use_def_chains_fn, void *, bool); void insert_debug_temps_for_defs (gimple_stmt_iterator *); void insert_debug_temp_for_var_def (gimple_stmt_iterator *, tree); +void reset_debug_uses (gimple); void release_defs_bitset (bitmap toremove); /* In tree-into-ssa.c */ diff --git a/gcc/tree-loop-distribution.c b/gcc/tree-loop-distribution.c index 5b147e31c81..1d6944eef96 100644 --- a/gcc/tree-loop-distribution.c +++ b/gcc/tree-loop-distribution.c @@ -1,5 +1,5 @@ /* Loop distribution. - Copyright (C) 2006, 2007, 2008, 2009, 2010 + Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. Contributed by Georges-Andre Silber <Georges-Andre.Silber@ensmp.fr> and Sebastian Pop <sebastian.pop@amd.com>. @@ -181,6 +181,25 @@ generate_loops_for_partition (struct loop *loop, bitmap partition, bool copy_p) stmts_from_loop. */ bbs = get_loop_body_in_dom_order (loop); + if (MAY_HAVE_DEBUG_STMTS) + for (x = 0, i = 0; i < loop->num_nodes; i++) + { + basic_block bb = bbs[i]; + + for (bsi = gsi_start_phis (bb); !gsi_end_p (bsi); gsi_next (&bsi)) + if (!bitmap_bit_p (partition, x++)) + reset_debug_uses (gsi_stmt (bsi)); + + for (bsi = gsi_start_bb (bb); !gsi_end_p (bsi); gsi_next (&bsi)) + { + gimple stmt = gsi_stmt (bsi); + if (gimple_code (stmt) != GIMPLE_LABEL + && !is_gimple_debug (stmt) + && !bitmap_bit_p (partition, x++)) + reset_debug_uses (stmt); + } + } + for (x = 0, i = 0; i < loop->num_nodes; i++) { basic_block bb = bbs[i]; @@ -199,7 +218,8 @@ generate_loops_for_partition (struct loop *loop, bitmap partition, bool copy_p) for (bsi = gsi_start_bb (bb); !gsi_end_p (bsi);) { gimple stmt = gsi_stmt (bsi); - if (gimple_code (gsi_stmt (bsi)) != GIMPLE_LABEL + if (gimple_code (stmt) != GIMPLE_LABEL + && !is_gimple_debug (stmt) && !bitmap_bit_p (partition, x++)) { unlink_stmt_vdef (stmt); @@ -312,7 +332,9 @@ generate_builtin (struct loop *loop, bitmap partition, bool copy_p) { gimple stmt = gsi_stmt (bsi); - if (bitmap_bit_p (partition, x++) + if (gimple_code (stmt) != GIMPLE_LABEL + && !is_gimple_debug (stmt) + && bitmap_bit_p (partition, x++) && is_gimple_assign (stmt) && !is_gimple_reg (gimple_assign_lhs (stmt))) { diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c index fe8a74c59cf..f596fcd870c 100644 --- a/gcc/tree-ssa.c +++ b/gcc/tree-ssa.c @@ -507,6 +507,37 @@ insert_debug_temps_for_defs (gimple_stmt_iterator *gsi) } } +/* Reset all debug stmts that use SSA_NAME(s) defined in STMT. */ + +void +reset_debug_uses (gimple stmt) +{ + ssa_op_iter op_iter; + def_operand_p def_p; + imm_use_iterator imm_iter; + gimple use_stmt; + + if (!MAY_HAVE_DEBUG_STMTS) + return; + + FOR_EACH_PHI_OR_STMT_DEF (def_p, stmt, op_iter, SSA_OP_DEF) + { + tree var = DEF_FROM_PTR (def_p); + + if (TREE_CODE (var) != SSA_NAME) + continue; + + FOR_EACH_IMM_USE_STMT (use_stmt, imm_iter, var) + { + if (!gimple_debug_bind_p (use_stmt)) + continue; + + gimple_debug_bind_reset_value (use_stmt); + update_stmt (use_stmt); + } + } +} + /* Delete SSA DEFs for SSA versions in the TOREMOVE bitmap, removing dominated stmts before their dominators, so that release_ssa_defs stands a chance of propagating DEFs into debug bind stmts. */ |