re PR tree-optimization/42878 ("-fcompare-debug failure" at -O1 (2))

2010-01-27  Richard Guenther  <rguenther@suse.de>

	PR middle-end/42878
	* tree-inline.c (remap_decl): Delay remapping of SSA name
	default definitions until we need them.

	* gcc.dg/torture/pr42878-1.c: New testcase.
	* gcc.dg/torture/pr42878-2.c: Likewise.

From-SVN: r156291
This commit is contained in:
Richard Guenther 2010-01-27 16:00:31 +00:00 committed by Richard Biener
parent 77597d3907
commit e87da26377
5 changed files with 76 additions and 10 deletions

View File

@ -1,3 +1,9 @@
2010-01-27 Richard Guenther <rguenther@suse.de>
PR middle-end/42878
* tree-inline.c (remap_decl): Delay remapping of SSA name
default definitions until we need them.
2010-01-27 Jakub Jelinek <jakub@redhat.com>
* config/rs6000/rs6000.c (TARGET_DELEGITIMIZE_ADDRESS): Redefine.

View File

@ -1,3 +1,9 @@
2010-01-27 Richard Guenther <rguenther@suse.de>
PR middle-end/42878
* gcc.dg/torture/pr42878-1.c: New testcase.
* gcc.dg/torture/pr42878-2.c: Likewise.
2010-01-27 Jakub Jelinek <jakub@redhat.com>
PR middle-end/42874

View File

@ -0,0 +1,30 @@
/* { dg-do compile } */
/* { dg-options "-fcompare-debug" } */
struct S {
int i;
};
extern struct S *e1(void);
extern int e2(int i);
static inline void f1()
{
int i;
struct S *s;
for (i = 0; i < 10; i++)
s = e1();
e2(s->i);
}
static inline void f2(int i)
{
int j = j;
j = e2(i);
}
void foo(int i)
{
f1();
f2(i);
}

View File

@ -0,0 +1,34 @@
/* { dg-do compile } */
/* { dg-options "-fcompare-debug" } */
extern void error(void) __attribute__((noreturn));
struct S {
struct S *s;
};
static inline unsigned char f2()
{
error();
}
static inline void f1()
{
int builtin_optab;
if (!f2() && builtin_optab)
error();
}
extern void f4(struct S *s);
static inline void f3(struct S *s)
{
f4(s->s->s);
}
void expand_builtin(struct S *s, int cond)
{
if (cond)
f1();
f3(s);
}

View File

@ -311,17 +311,7 @@ remap_decl (tree decl, copy_body_data *id)
&& (TREE_CODE (t) == VAR_DECL
|| TREE_CODE (t) == RESULT_DECL || TREE_CODE (t) == PARM_DECL))
{
tree def = gimple_default_def (id->src_cfun, decl);
get_var_ann (t);
if (TREE_CODE (decl) != PARM_DECL && def)
{
tree map = remap_ssa_name (def, id);
/* Watch out RESULT_DECLs whose SSA names map directly
to them. */
if (TREE_CODE (map) == SSA_NAME
&& gimple_nop_p (SSA_NAME_DEF_STMT (map)))
set_default_def (t, map);
}
add_referenced_var (t);
}
return t;