re PR target/44903 (FAIL: gcc.dg/pr35258.c execution test)

2010-07-28  Richard Guenther  <rguenther@suse.de>

	PR middle-end/44903
	* builtins.c (fold_builtin_memory_op): On STRICT_ALIGNMENT
	targets try harder to not generate unaligned accesses.

From-SVN: r162624
This commit is contained in:
Richard Guenther 2010-07-28 10:32:54 +00:00 committed by Richard Biener
parent bb801fa63c
commit 3abd6c1abf
2 changed files with 16 additions and 1 deletions

View file

@ -1,3 +1,9 @@
2010-07-28 Richard Guenther <rguenther@suse.de>
PR middle-end/44903
* builtins.c (fold_builtin_memory_op): On STRICT_ALIGNMENT
targets try harder to not generate unaligned accesses.
2010-07-28 Maxim Kuvyrkov <maxim@codesourcery.com>
PR rtl-optimization/45101

View file

@ -8474,7 +8474,10 @@ fold_builtin_memory_op (location_t loc, tree dest, tree src,
STRIP_NOPS (srcvar);
if (TREE_CODE (srcvar) == ADDR_EXPR
&& var_decl_component_p (TREE_OPERAND (srcvar, 0))
&& tree_int_cst_equal (TYPE_SIZE_UNIT (srctype), len))
&& tree_int_cst_equal (TYPE_SIZE_UNIT (srctype), len)
&& (!STRICT_ALIGNMENT
|| !destvar
|| src_align >= (int) TYPE_ALIGN (desttype)))
srcvar = fold_build2 (MEM_REF, destvar ? desttype : srctype,
srcvar, off0);
else
@ -8485,11 +8488,17 @@ fold_builtin_memory_op (location_t loc, tree dest, tree src,
if (srcvar == NULL_TREE)
{
if (STRICT_ALIGNMENT
&& src_align < (int) TYPE_ALIGN (desttype))
return NULL_TREE;
STRIP_NOPS (src);
srcvar = fold_build2 (MEM_REF, desttype, src, off0);
}
else if (destvar == NULL_TREE)
{
if (STRICT_ALIGNMENT
&& dest_align < (int) TYPE_ALIGN (srctype))
return NULL_TREE;
STRIP_NOPS (dest);
destvar = fold_build2 (MEM_REF, srctype, dest, off0);
}