]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR target/44903 (FAIL: gcc.dg/pr35258.c execution test)
authorRichard Guenther <rguenther@suse.de>
Wed, 28 Jul 2010 10:32:54 +0000 (10:32 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Wed, 28 Jul 2010 10:32:54 +0000 (10:32 +0000)
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

gcc/ChangeLog
gcc/builtins.c

index d31aec79a0ad8fd45f33e05977912f264e2e3af3..f2fe41f7a9fcde03403b2ee67ff938241cd2d1cb 100644 (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
index 9b6fb1033b1722b1eca06155150896c39f50d155..b20426cd784cb333632ca0b7bd2e01f9bc1173f3 100644 (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);
        }