From 434c8f4b99a89391ee874db02f0395979792eb3f Mon Sep 17 00:00:00 2001 From: Richard Guenther Date: Mon, 1 Mar 2010 12:56:44 +0000 Subject: re PR tree-optimization/43213 (Worse code generated with -O2) 2010-03-01 Richard Guenther PR middle-end/43213 * expr.c (expand_assignment): Use the alias-oracle to tell if the rhs aliases the result decl. * gcc.dg/pr43213.c: New testcase. From-SVN: r157142 --- gcc/expr.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'gcc/expr.c') diff --git a/gcc/expr.c b/gcc/expr.c index cd013b023a6..1e74f2a6911 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -4432,9 +4432,11 @@ expand_assignment (tree to, tree from, bool nontemporal) /* In case we are returning the contents of an object which overlaps the place the value is being stored, use a safe function when copying a value through a pointer into a structure value return block. */ - if (TREE_CODE (to) == RESULT_DECL && TREE_CODE (from) == INDIRECT_REF + if (TREE_CODE (to) == RESULT_DECL + && TREE_CODE (from) == INDIRECT_REF && ADDR_SPACE_GENERIC_P - (TYPE_ADDR_SPACE (TREE_TYPE (TREE_TYPE (TREE_OPERAND (from, 0))))) + (TYPE_ADDR_SPACE (TREE_TYPE (TREE_TYPE (TREE_OPERAND (from, 0))))) + && refs_may_alias_p (to, from) && cfun->returns_struct && !cfun->returns_pcc_struct) { -- cgit v1.2.1