re PR tree-optimization/51877 (XEmacs miscompilation due to tail merging)
PR tree-optimization/51877 * tree-ssa-tail-merge.c (gimple_equal_p): Don't return true whenever call arguments and fndecls compare equal, instead return false if they don't. Return true only if lhs1 and lhs2 are either both NULL, or both SSA_NAMEs that are valueized the same, or they satisfy operand_equal_p. * gcc.c-torture/execute/pr51877.c: New test. From-SVN: r183237
This commit is contained in:
parent
6521d80a9b
commit
e6fa9204e6
|
@ -1,3 +1,12 @@
|
||||||
|
2012-01-17 Jakub Jelinek <jakub@redhat.com>
|
||||||
|
|
||||||
|
PR tree-optimization/51877
|
||||||
|
* tree-ssa-tail-merge.c (gimple_equal_p): Don't return true whenever
|
||||||
|
call arguments and fndecls compare equal, instead return false if they
|
||||||
|
don't. Return true only if lhs1 and lhs2 are either both NULL, or
|
||||||
|
both SSA_NAMEs that are valueized the same, or they satisfy
|
||||||
|
operand_equal_p.
|
||||||
|
|
||||||
2012-01-17 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
|
2012-01-17 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
|
||||||
|
|
||||||
* configure.ac (gcc_cv_target_dl_iterate_phdr): Only check on
|
* configure.ac (gcc_cv_target_dl_iterate_phdr): Only check on
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
2012-01-17 Jakub Jelinek <jakub@redhat.com>
|
||||||
|
|
||||||
|
PR tree-optimization/51877
|
||||||
|
* gcc.c-torture/execute/pr51877.c: New test.
|
||||||
|
|
||||||
2012-01-17 Michael Zolotukhin <michael.v.zolotukhin@intel.com>
|
2012-01-17 Michael Zolotukhin <michael.v.zolotukhin@intel.com>
|
||||||
|
|
||||||
* gcc.dg/vect/no-section-anchors-vect-69.c: Change
|
* gcc.dg/vect/no-section-anchors-vect-69.c: Change
|
||||||
|
|
|
@ -0,0 +1,50 @@
|
||||||
|
/* PR tree-optimization/51877 */
|
||||||
|
|
||||||
|
extern void abort (void);
|
||||||
|
struct A { int a; char b[32]; } a, b;
|
||||||
|
|
||||||
|
__attribute__((noinline, noclone))
|
||||||
|
struct A
|
||||||
|
bar (int x)
|
||||||
|
{
|
||||||
|
struct A r;
|
||||||
|
static int n;
|
||||||
|
r.a = ++n;
|
||||||
|
__builtin_memset (r.b, 0, sizeof (r.b));
|
||||||
|
r.b[0] = x;
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
__attribute__((noinline, noclone))
|
||||||
|
void
|
||||||
|
baz (void)
|
||||||
|
{
|
||||||
|
asm volatile ("" : : : "memory");
|
||||||
|
}
|
||||||
|
|
||||||
|
__attribute__((noinline, noclone))
|
||||||
|
void
|
||||||
|
foo (struct A *x, int y)
|
||||||
|
{
|
||||||
|
if (y == 6)
|
||||||
|
a = bar (7);
|
||||||
|
else
|
||||||
|
*x = bar (7);
|
||||||
|
baz ();
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
main ()
|
||||||
|
{
|
||||||
|
a = bar (3);
|
||||||
|
b = bar (4);
|
||||||
|
if (a.a != 1 || a.b[0] != 3 || b.a != 2 || b.b[0] != 4)
|
||||||
|
abort ();
|
||||||
|
foo (&b, 0);
|
||||||
|
if (a.a != 1 || a.b[0] != 3 || b.a != 3 || b.b[0] != 7)
|
||||||
|
abort ();
|
||||||
|
foo (&b, 6);
|
||||||
|
if (a.a != 4 || a.b[0] != 7 || b.a != 3 || b.b[0] != 7)
|
||||||
|
abort ();
|
||||||
|
return 0;
|
||||||
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
/* Tail merging for gimple.
|
/* Tail merging for gimple.
|
||||||
Copyright (C) 2011 Free Software Foundation, Inc.
|
Copyright (C) 2011, 2012 Free Software Foundation, Inc.
|
||||||
Contributed by Tom de Vries (tom@codesourcery.com)
|
Contributed by Tom de Vries (tom@codesourcery.com)
|
||||||
|
|
||||||
This file is part of GCC.
|
This file is part of GCC.
|
||||||
|
@ -1071,14 +1071,18 @@ gimple_equal_p (same_succ same_succ, gimple s1, gimple s2)
|
||||||
equal = false;
|
equal = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (equal)
|
if (!equal)
|
||||||
return true;
|
return false;
|
||||||
|
|
||||||
lhs1 = gimple_get_lhs (s1);
|
lhs1 = gimple_get_lhs (s1);
|
||||||
lhs2 = gimple_get_lhs (s2);
|
lhs2 = gimple_get_lhs (s2);
|
||||||
return (lhs1 != NULL_TREE && lhs2 != NULL_TREE
|
if (lhs1 == NULL_TREE && lhs2 == NULL_TREE)
|
||||||
&& TREE_CODE (lhs1) == SSA_NAME && TREE_CODE (lhs2) == SSA_NAME
|
return true;
|
||||||
&& vn_valueize (lhs1) == vn_valueize (lhs2));
|
if (lhs1 == NULL_TREE || lhs2 == NULL_TREE)
|
||||||
|
return false;
|
||||||
|
if (TREE_CODE (lhs1) == SSA_NAME && TREE_CODE (lhs2) == SSA_NAME)
|
||||||
|
return vn_valueize (lhs1) == vn_valueize (lhs2);
|
||||||
|
return operand_equal_p (lhs1, lhs2, 0);
|
||||||
|
|
||||||
case GIMPLE_ASSIGN:
|
case GIMPLE_ASSIGN:
|
||||||
lhs1 = gimple_get_lhs (s1);
|
lhs1 = gimple_get_lhs (s1);
|
||||||
|
|
Loading…
Reference in New Issue