Commit 3abd6c1a by Richard Guenther Committed by Richard Biener

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
parent bb801fa6
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> 2010-07-28 Maxim Kuvyrkov <maxim@codesourcery.com>
PR rtl-optimization/45101 PR rtl-optimization/45101
......
...@@ -8474,7 +8474,10 @@ fold_builtin_memory_op (location_t loc, tree dest, tree src, ...@@ -8474,7 +8474,10 @@ fold_builtin_memory_op (location_t loc, tree dest, tree src,
STRIP_NOPS (srcvar); STRIP_NOPS (srcvar);
if (TREE_CODE (srcvar) == ADDR_EXPR if (TREE_CODE (srcvar) == ADDR_EXPR
&& var_decl_component_p (TREE_OPERAND (srcvar, 0)) && 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 = fold_build2 (MEM_REF, destvar ? desttype : srctype,
srcvar, off0); srcvar, off0);
else else
...@@ -8485,11 +8488,17 @@ fold_builtin_memory_op (location_t loc, tree dest, tree src, ...@@ -8485,11 +8488,17 @@ fold_builtin_memory_op (location_t loc, tree dest, tree src,
if (srcvar == NULL_TREE) if (srcvar == NULL_TREE)
{ {
if (STRICT_ALIGNMENT
&& src_align < (int) TYPE_ALIGN (desttype))
return NULL_TREE;
STRIP_NOPS (src); STRIP_NOPS (src);
srcvar = fold_build2 (MEM_REF, desttype, src, off0); srcvar = fold_build2 (MEM_REF, desttype, src, off0);
} }
else if (destvar == NULL_TREE) else if (destvar == NULL_TREE)
{ {
if (STRICT_ALIGNMENT
&& dest_align < (int) TYPE_ALIGN (srctype))
return NULL_TREE;
STRIP_NOPS (dest); STRIP_NOPS (dest);
destvar = fold_build2 (MEM_REF, srctype, dest, off0); destvar = fold_build2 (MEM_REF, srctype, dest, off0);
} }
......
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