Hi, PR78646 identifies a case where the base expression for a strength-reduced memory reference gets a type of insufficient alignment. This pointed out the fact that we should use the type of the candidate expression for the new base expression in all cases. Patch by Stefan M. Freudenberger.
Bootstrapped and tested on powerpc64le-unknown-linux-gnu with no regressions. Tested with a powerpc64le->x86_64 cross to verify the correct type is now chosen. Committed. Thanks, Bill 2016-12-05 Bill Schmidt <wschm...@linux.vnet.ibm.com> Stefan Freudenberger <ste...@reservoir.com> PR tree-optimization/78646 * gimple-ssa-strength-reduction.c (replace_ref): The pointer addition used for the memory base expression should have the type of the candidate. Index: gcc/gimple-ssa-strength-reduction.c =================================================================== --- gcc/gimple-ssa-strength-reduction.c (revision 243264) +++ gcc/gimple-ssa-strength-reduction.c (working copy) @@ -1921,7 +1921,7 @@ replace_ref (tree *expr, slsr_cand_t c) if (align < TYPE_ALIGN (acc_type)) acc_type = build_aligned_type (acc_type, align); - add_expr = fold_build2 (POINTER_PLUS_EXPR, TREE_TYPE (c->base_expr), + add_expr = fold_build2 (POINTER_PLUS_EXPR, c->cand_type, c->base_expr, c->stride); mem_ref = fold_build2 (MEM_REF, acc_type, add_expr, wide_int_to_tree (c->cand_type, c->index));