Use poly_int tree accessors
commita5b13adae8ce53fa00334723c0a81a1cc6b3b82e
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 30 May 2018 06:31:47 +0000 (30 06:31 +0000)
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 30 May 2018 06:31:47 +0000 (30 06:31 +0000)
tree34d36011aa1f1b4d6e8fba4506d1fcf929336859
parent70d336ec8b4bc5b56c3404e6f5acab48690e43d4
Use poly_int tree accessors

This patch generalises various places that used hwi tree accessors so
that they can handle poly_ints instead.  In many cases these changes
are by inspection rather than because something had shown them to be
necessary.

I think the alias.c part is a minor bug fix: previously we used
fits_uhwi_p for a signed HOST_WIDE_INT (which the caller does
treat as signed rather than unsigned).  We also checked whether
each individual offset overflowed but didn't check whether the
sum did.

2018-05-30  Richard Sandiford  <richard.sandiford@linaro.org>

gcc/
* alias.c (adjust_offset_for_component_ref): Use poly_int_tree_p
and wi::to_poly_offset.  Add the current offset and then check
whether the sum fits, rather than using an unchecked addition of
a checked term.  Check for a shwi rather than a uhwi.
* expr.c (get_bit_range): Use tree_to_poly_uint64.
(store_constructor): Use poly_int_tree_p.
(expand_expr_real_1): Likewise.
* function.c (assign_temp): Likewise.
* fold-const.c (const_binop): Use poly_int_tree_p and
wi::to_poly_offset.
(fold_indirect_ref_1): Likewise.  Use multiple_p to attempt an exact
division.
* ipa-icf-gimple.c (func_checker::compare_operand): Use
to_poly_offset for MEM offsets.
* ipa-icf.c (sem_variable::equals): Likewise.
* stor-layout.c (compute_record_mode): Use poly_int_tree_p.
* tree-ssa-sccvn.c (ao_ref_init_from_vn_reference): Use
wi::to_poly_offset for BIT_FIELD_REF offsets.
(vn_reference_maybe_forwprop_address): Use poly_int_tree_p and
wi::to_poly_offset.
* var-tracking.c (emit_note_insn_var_location): Use
tree_to_poly_uint64.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@260914 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/ChangeLog
gcc/alias.c
gcc/expr.c
gcc/fold-const.c
gcc/function.c
gcc/ipa-icf-gimple.c
gcc/ipa-icf.c
gcc/stor-layout.c
gcc/tree-ssa-sccvn.c
gcc/var-tracking.c