re PR tree-optimization/54981 (Different code generated with / without `-g')

2012-10-19  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/54981
	* tree-loop-distribution.c (ssa_name_has_uses_outside_loop_p):
	Do not consider debug stmts as uses.

	* gcc.dg/pr54981.c: New testcase.

From-SVN: r192612
This commit is contained in:
Richard Guenther 2012-10-19 13:05:40 +00:00 committed by Richard Biener
parent dfc2e2acc9
commit e665269ada
4 changed files with 32 additions and 2 deletions

View file

@ -1,3 +1,9 @@
2012-10-19 Richard Guenther <rguenther@suse.de>
PR tree-optimization/54981
* tree-loop-distribution.c (ssa_name_has_uses_outside_loop_p):
Do not consider debug stmts as uses.
2012-10-19 Richard Biener <rguenther@suse.de>
PR tree-optimization/54976

View file

@ -1,3 +1,8 @@
2012-10-19 Richard Guenther <rguenther@suse.de>
PR tree-optimization/54981
* gcc.dg/pr54981.c: New testcase.
2012-10-19 Zhenqiang Chen <zhenqiang.chen@linaro.org>
PR target/54892

View file

@ -0,0 +1,15 @@
/* { dg-do compile } */
/* { dg-options "-O -ftree-loop-distribute-patterns -fcompare-debug" } */
extern void bar(unsigned *, char *);
void foo(char *s)
{
unsigned i;
char t[2];
bar(&i, t);
for (i = 0; i < 2; i++)
s[i] = t[i];
}

View file

@ -125,8 +125,12 @@ ssa_name_has_uses_outside_loop_p (tree def, loop_p loop)
use_operand_p use_p;
FOR_EACH_IMM_USE_FAST (use_p, imm_iter, def)
if (loop != loop_containing_stmt (USE_STMT (use_p)))
return true;
{
gimple use_stmt = USE_STMT (use_p);
if (!is_gimple_debug (use_stmt)
&& loop != loop_containing_stmt (use_stmt))
return true;
}
return false;
}