From: Richard Biener Date: Mon, 18 Jul 2016 08:46:42 +0000 (+0000) Subject: re PR tree-optimization/71893 (gfortran.dg ICEs in gcc/tree-ssa-pre.c; -fcode-hoisting?) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2e7565b2681274a88ec2c74c6486ca4657295d21;p=gcc.git re PR tree-optimization/71893 (gfortran.dg ICEs in gcc/tree-ssa-pre.c; -fcode-hoisting?) 2016-07-18 Richard Biener 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 62ca076d1d5..1f3fabf321b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2016-07-18 Richard Biener + + 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 * config/pa/pa.c (hppa_profile_hook): Allocate stack space for diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c index c45eb2e9095..c59aab8d0ff 100644 --- a/gcc/tree-ssa-pre.c +++ b/gcc/tree-ssa-pre.c @@ -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; diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c index bd752a5eccd..b1f10d50771 100644 --- a/gcc/tree-ssa-sccvn.c +++ b/gcc/tree-ssa-sccvn.c @@ -810,6 +810,9 @@ copy_reference_ops_from_ref (tree ref, vec *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)