Commit b03c3082 by Jakub Jelinek Committed by Jakub Jelinek

re PR debug/48159 (ICE: SIGSEGV in build2_stat (tree.c:3802) with -ftree-loop-distribution -g)

	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.

From-SVN: r173656
parent b5e04de5
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 ...
......
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
......
/* 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;
}
/* 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];
}
/* 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);
}
}
......
......@@ -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 */
......
/* 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)))
{
......
......@@ -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. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment