Commit 824ff0cd by Richard Guenther Committed by Richard Biener

re PR middle-end/36143 (FAIL: g++.dg/tree-ssa/pr19637.C)

2009-09-24  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/36143
	PR tree-optimization/38747
	* tree-ssa-forwprop.c (forward_propagate_addr_expr_1): Only
	create VIEW_CONVERT_EXPRs for TBAA compatible accesses.

	* gcc.dg/tree-ssa/fre-vce-1.c: XFAIL.
	* gcc.dg/tree-ssa/forwprop-6.c: Likewise.
	* g++.dg/torture/pr38747.C: New testcase.
	* g++.dg/tree-ssa/pr19637.C: Un-XFAIL.

From-SVN: r152122
parent 3f13dd77
2009-09-24 Richard Guenther <rguenther@suse.de>
PR tree-optimization/36143
PR tree-optimization/38747
* tree-ssa-forwprop.c (forward_propagate_addr_expr_1): Only
create VIEW_CONVERT_EXPRs for TBAA compatible accesses.
2009-09-24 Jakub Jelinek <jakub@redhat.com>
PR bootstrap/41457
......
2009-09-24 Richard Guenther <rguenther@suse.de>
PR tree-optimization/36143
PR tree-optimization/38747
* gcc.dg/tree-ssa/fre-vce-1.c: XFAIL.
* gcc.dg/tree-ssa/forwprop-6.c: Likewise.
* g++.dg/torture/pr38747.C: New testcase.
* g++.dg/tree-ssa/pr19637.C: Un-XFAIL.
2009-09-24 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/nested_proc.adb: New test.
......
/* { dg-do run } */
extern "C" void abort (void);
inline void *operator new (__SIZE_TYPE__, void *__p) throw () { return __p; }
int __attribute__((noinline))
foo(void)
{
float f = 0;
int *i = new (&f) int (1);
return *(int *)&f;
}
int main()
{
if (foo() != 1)
abort ();
return 0;
}
......@@ -29,6 +29,5 @@ int foo_void_offset(void)
return reinterpret_cast<Foo *>(&i[0])->i[0];
}
/* Regarding the xfail, see PR36143. */
/* { dg-final { scan-tree-dump-times "return 1;" 3 "dom1" { xfail *-*-* } } } */
/* { dg-final { scan-tree-dump-times "return 1;" 3 "dom1" } } */
/* { dg-final { cleanup-tree-dump "dom1" } } */
......@@ -17,6 +17,11 @@ void f(void)
}
/* We should be able to convert the cast to a VCE in forwprop1,
even if there is an aliasing violation. */
/* { dg-final { scan-tree-dump-times "VIEW_CONVERT_EXPR" 1 "forwprop1"} } */
even if there is an aliasing violation.
??? While this would be useful and nice to our users in this
particular situation before doing this transformation we have to
assure that a is killed by a dominating store via type float for
it to be valid. Then we might as well handle the situation by
value-numbering, removing the load alltogether. */
/* { dg-final { scan-tree-dump-times "VIEW_CONVERT_EXPR" 1 "forwprop1" { xfail *-*-* } } } */
/* { dg-final { cleanup-tree-dump "forwprop1" } } */
......@@ -32,6 +32,7 @@ void a2 (struct s1 sv, int i)
}
/* { dg-final { scan-tree-dump-times "sv_\[0-9\]\\\(D\\\)->i" 2 "fre" } } */
/* { dg-final { scan-tree-dump-times "sv.i" 2 "fre" } } */
/* We can't value-number *(float *)&sv.i as VIEW_CONVERT_EXPR of the
value of sv.i. */
/* { dg-final { scan-tree-dump-times "sv.i" 2 "fre" { xfail *-*-* } } } */
/* { dg-final { cleanup-tree-dump "fre" } } */
......@@ -831,7 +831,9 @@ forward_propagate_addr_expr_1 (tree name, tree def_rhs,
&& !TYPE_VOLATILE (TREE_TYPE (rhs))
&& !TYPE_VOLATILE (TREE_TYPE (TREE_OPERAND (def_rhs, 0)))
&& operand_equal_p (TYPE_SIZE (TREE_TYPE (rhs)),
TYPE_SIZE (TREE_TYPE (TREE_OPERAND (def_rhs, 0))), 0))
TYPE_SIZE (TREE_TYPE (TREE_OPERAND (def_rhs, 0))), 0)
/* Make sure we only do TBAA compatible replacements. */
&& get_alias_set (TREE_OPERAND (def_rhs, 0)) == get_alias_set (rhs))
{
tree def_rhs_base, new_rhs = unshare_expr (TREE_OPERAND (def_rhs, 0));
new_rhs = fold_build1 (VIEW_CONVERT_EXPR, TREE_TYPE (rhs), new_rhs);
......
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