[PATCH] tree-optimization/103759: Truncate unknown to sizetype on compare
Jakub Jelinek
jakub@redhat.com
Fri Dec 17 21:47:11 GMT 2021
On Sat, Dec 18, 2021 at 02:53:47AM +0530, Siddhesh Poyarekar wrote:
> Since all computations in tree-object-size are now done in sizetype and
> not HOST_WIDE_INT, comparisons after conversion to HOST_WIDE_INT would
> be incorrect. Instead, truncate unknown (object_size_type) to sizetype
> to compare with the computed size to evaluate if it is unknown.
>
> gcc/ChangeLog:
>
> PR tree-optimization/103759
> * tree-object-size (size_unknown_p): Construct a size_unknown
> and compare with VAL.
I think you should instead drop initval and unknown inlines and
rewrite size_unknown, size_initval and size_unknown_p to work
directly on trees.
size_initval to
return ((object_size_type & OST_MINIMUM)
? TYPE_MAX_VALUE (sizetype) : size_zero_node);
size_unknown to
return ((object_size_type & OST_MINIMUM)
? size_zero_node : TYPE_MAX_VALUE (sizetype));
and size_unknown_p to:
return ((object_size_type & OST_MINIMUM)
? integer_zerop (val) : integer_all_onesp (val));
Jakub
More information about the Gcc-patches
mailing list