re PR tree-optimization/71893 (gfortran.dg ICEs in gcc/tree-ssa-pre.c; -fcode-hoisting?)
authorRichard Biener <rguenther@suse.de>
Mon, 18 Jul 2016 08:46:42 +0000 (08:46 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Mon, 18 Jul 2016 08:46:42 +0000 (08:46 +0000)
2016-07-18  Richard Biener  <rguenther@suse.de>

PR tree-optimization/71893
* tree-ssa-pre.c (create_component_ref_by_pieces_1): Compensate
for sizetype cast added by array_ref_element_size.
* tree-ssa-sccvn.c (copy_reference_ops_from_ref): Likewise.

From-SVN: r238426

gcc/ChangeLog
gcc/tree-ssa-pre.c
gcc/tree-ssa-sccvn.c

index 62ca076d1d5ecdeb626a1a9c8d5318aa4da20752..1f3fabf321bb7de90e79b1f0dd770fe90d387b04 100644 (file)
@@ -1,3 +1,10 @@
+2016-07-18  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/71893
+       * tree-ssa-pre.c (create_component_ref_by_pieces_1): Compensate
+       for sizetype cast added by array_ref_element_size.
+       * tree-ssa-sccvn.c (copy_reference_ops_from_ref): Likewise.
+
 2016-07-16  John David Anglin  <danglin@gcc.gnu.org>
 
        * config/pa/pa.c (hppa_profile_hook): Allocate stack space for
index c45eb2e9095a91d957614dc99c57111af9f703bf..c59aab8d0ff32ebff43702143691b249619c11ce 100644 (file)
@@ -2576,6 +2576,9 @@ create_component_ref_by_pieces_1 (basic_block block, vn_reference_t ref,
              {
                genop3 = size_binop (EXACT_DIV_EXPR, genop3,
                                     size_int (TYPE_ALIGN_UNIT (elmt_type)));
+               /* We may have a useless conversion added by
+                  array_ref_element_size via copy_reference_opts_from_ref.  */
+               STRIP_USELESS_TYPE_CONVERSION (genop3);
                genop3 = find_or_generate_expression (block, genop3, stmts);
                if (!genop3)
                  return NULL_TREE;
index bd752a5eccd78bb7ed56b43dbcd74d59add77fbc..b1f10d50771d66c6d715c3fe462dc034afb187de 100644 (file)
@@ -810,6 +810,9 @@ copy_reference_ops_from_ref (tree ref, vec<vn_reference_op_s> *result)
          /* Always record lower bounds and element size.  */
          temp.op1 = array_ref_low_bound (ref);
          temp.op2 = array_ref_element_size (ref);
+         /* array_ref_element_size forces the result to sizetype
+            even if that is the same as bitsizetype.  */
+         STRIP_USELESS_TYPE_CONVERSION (temp.op2);
          if (TREE_CODE (temp.op0) == INTEGER_CST
              && TREE_CODE (temp.op1) == INTEGER_CST
              && TREE_CODE (temp.op2) == INTEGER_CST)