re PR tree-optimization/78646 (incorrect result type for pointer addition in slsr)
authorBill Schmidt <wschmidt@linux.vnet.ibm.com>
Mon, 5 Dec 2016 21:48:27 +0000 (21:48 +0000)
committerWilliam Schmidt <wschmidt@gcc.gnu.org>
Mon, 5 Dec 2016 21:48:27 +0000 (21:48 +0000)
2016-12-05  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
    Stefan Freudenberger  <stefan@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.

Co-Authored-By: Stefan Freudenberger <stefan@reservoir.com>
From-SVN: r243272

gcc/ChangeLog
gcc/gimple-ssa-strength-reduction.c

index 57c2450c1bed4dfdc4357160744664751a71fdc3..beef9212587c9d3e2bc72b75876bb6e738d4d249 100644 (file)
@@ -1,3 +1,11 @@
+2016-12-05  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
+           Stefan Freudenberger  <stefan@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.
+
 2016-12-05  Waldemar Brodkorb  <wbx@openadk.org>
 
        PR target/71721
index bdfdb9a82b196a8c928e412dca3792ca45ce7a0d..21dcbb050568fce9c791490998fdaf1c4f4429e2 100644 (file)
@@ -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));