diff options
author | Bernd Edlinger <bernd.edlinger@hotmail.de> | 2016-08-11 13:07:29 +0000 |
---|---|---|
committer | Bernd Edlinger <edlinger@gcc.gnu.org> | 2016-08-11 13:07:29 +0000 |
commit | 5953774463a728b111d685f9840ff6935229b8d6 (patch) | |
tree | d40aa43345c886e9b92620dd9a33350b139f2768 /gcc/tree-predcom.c | |
parent | 2d71f118839eae04db411982ca9c578e72038461 (diff) | |
download | gcc-5953774463a728b111d685f9840ff6935229b8d6.zip gcc-5953774463a728b111d685f9840ff6935229b8d6.tar.gz gcc-5953774463a728b111d685f9840ff6935229b8d6.tar.bz2 |
re PR tree-optimization/71083 (Unaligned bit-field address when predictive commoning)
2016-08-11 Bernd Edlinger <bernd.edlinger@hotmail.de>
PR tree-optimization/71083
* tree-predcom.c (ref_at_iteration): Correctly align the
reference type.
testsuite:
2016-08-11 Bernd Edlinger <bernd.edlinger@hotmail.de>
PR tree-optimization/71083
* gcc.c-torture/execute/pr71083.c: New test.
* gnat.dg/loop_optimization23.adb: New test.
* gnat.dg/loop_optimization23_pkg.ads: New test.
* gnat.dg/loop_optimization23_pkg.adb: New test.
From-SVN: r239362
Diffstat (limited to 'gcc/tree-predcom.c')
-rw-r--r-- | gcc/tree-predcom.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/gcc/tree-predcom.c b/gcc/tree-predcom.c index ebebdd6..843f68e 100644 --- a/gcc/tree-predcom.c +++ b/gcc/tree-predcom.c @@ -213,6 +213,7 @@ along with GCC; see the file COPYING3. If not see #include "tree-scalar-evolution.h" #include "params.h" #include "tree-affine.h" +#include "builtins.h" /* The maximum number of iterations between the considered memory references. */ @@ -1381,6 +1382,8 @@ ref_at_iteration (data_reference_p dr, int iter, gimple_seq *stmts) addr = force_gimple_operand_1 (unshare_expr (addr), stmts, is_gimple_mem_ref_addr, NULL_TREE); tree alias_ptr = fold_convert (reference_alias_ptr_type (DR_REF (dr)), coff); + tree type = build_aligned_type (TREE_TYPE (DR_REF (dr)), + get_object_alignment (DR_REF (dr))); /* While data-ref analysis punts on bit offsets it still handles bitfield accesses at byte boundaries. Cope with that. Note that we cannot simply re-apply the outer COMPONENT_REF because the @@ -1392,12 +1395,11 @@ ref_at_iteration (data_reference_p dr, int iter, gimple_seq *stmts) { tree field = TREE_OPERAND (DR_REF (dr), 1); return build3 (BIT_FIELD_REF, TREE_TYPE (DR_REF (dr)), - build2 (MEM_REF, DECL_BIT_FIELD_TYPE (field), - addr, alias_ptr), + build2 (MEM_REF, type, addr, alias_ptr), DECL_SIZE (field), bitsize_zero_node); } else - return fold_build2 (MEM_REF, TREE_TYPE (DR_REF (dr)), addr, alias_ptr); + return fold_build2 (MEM_REF, type, addr, alias_ptr); } /* Get the initialization expression for the INDEX-th temporary variable |