* Fix unguarded use of tree_to_shwi in tree-ssa-sccvn.c
@ 2018-08-28 10:39 Richard Sandiford
2018-08-28 10:41 ` Richard Biener
0 siblings, 1 reply; 2+ messages in thread
From: Richard Sandiford @ 2018-08-28 10:39 UTC (permalink / raw)
To: gcc-patches
Fixes many testsuite failures for SVE.
Tested on aarch64-linux-gnu (with and without SVE), aarch64_be-elf
and x86_64-linux-gnu. OK to install?
Richard
2018-08-28 Richard Sandiford <richard.sandiford@arm.com>
gcc/
* tree-ssa-sccvn.c (fully_constant_vn_reference_p): Fix unguarded
use of tree_to_shwi. Remove duplicated test for the size being
a whole number of bytes.
Index: gcc/tree-ssa-sccvn.c
===================================================================
--- gcc/tree-ssa-sccvn.c 2018-08-28 11:38:22.000000000 +0100
+++ gcc/tree-ssa-sccvn.c 2018-08-28 11:38:22.676512354 +0100
@@ -1409,16 +1409,16 @@ fully_constant_vn_reference_p (vn_refere
/* Simplify reads from constants or constant initializers. */
else if (BITS_PER_UNIT == 8
&& COMPLETE_TYPE_P (ref->type)
- && is_gimple_reg_type (ref->type)
- && (!INTEGRAL_TYPE_P (ref->type)
- || TYPE_PRECISION (ref->type) % BITS_PER_UNIT == 0))
+ && is_gimple_reg_type (ref->type))
{
poly_int64 off = 0;
HOST_WIDE_INT size;
if (INTEGRAL_TYPE_P (ref->type))
size = TYPE_PRECISION (ref->type);
- else
+ else if (tree_fits_shwi_p (TYPE_SIZE (ref->type)))
size = tree_to_shwi (TYPE_SIZE (ref->type));
+ else
+ return NULL_TREE;
if (size % BITS_PER_UNIT != 0
|| size > MAX_BITSIZE_MODE_ANY_MODE)
return NULL_TREE;
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Fix unguarded use of tree_to_shwi in tree-ssa-sccvn.c
2018-08-28 10:39 Fix unguarded use of tree_to_shwi in tree-ssa-sccvn.c Richard Sandiford
@ 2018-08-28 10:41 ` Richard Biener
0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2018-08-28 10:41 UTC (permalink / raw)
To: GCC Patches, Richard Sandiford
On Tue, Aug 28, 2018 at 12:39 PM Richard Sandiford
<richard.sandiford@arm.com> wrote:
>
> Fixes many testsuite failures for SVE.
>
> Tested on aarch64-linux-gnu (with and without SVE), aarch64_be-elf
> and x86_64-linux-gnu. OK to install?
OK.
Richard.
> Richard
>
>
> 2018-08-28 Richard Sandiford <richard.sandiford@arm.com>
>
> gcc/
> * tree-ssa-sccvn.c (fully_constant_vn_reference_p): Fix unguarded
> use of tree_to_shwi. Remove duplicated test for the size being
> a whole number of bytes.
>
> Index: gcc/tree-ssa-sccvn.c
> ===================================================================
> --- gcc/tree-ssa-sccvn.c 2018-08-28 11:38:22.000000000 +0100
> +++ gcc/tree-ssa-sccvn.c 2018-08-28 11:38:22.676512354 +0100
> @@ -1409,16 +1409,16 @@ fully_constant_vn_reference_p (vn_refere
> /* Simplify reads from constants or constant initializers. */
> else if (BITS_PER_UNIT == 8
> && COMPLETE_TYPE_P (ref->type)
> - && is_gimple_reg_type (ref->type)
> - && (!INTEGRAL_TYPE_P (ref->type)
> - || TYPE_PRECISION (ref->type) % BITS_PER_UNIT == 0))
> + && is_gimple_reg_type (ref->type))
> {
> poly_int64 off = 0;
> HOST_WIDE_INT size;
> if (INTEGRAL_TYPE_P (ref->type))
> size = TYPE_PRECISION (ref->type);
> - else
> + else if (tree_fits_shwi_p (TYPE_SIZE (ref->type)))
> size = tree_to_shwi (TYPE_SIZE (ref->type));
> + else
> + return NULL_TREE;
> if (size % BITS_PER_UNIT != 0
> || size > MAX_BITSIZE_MODE_ANY_MODE)
> return NULL_TREE;
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-08-28 10:41 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-28 10:39 Fix unguarded use of tree_to_shwi in tree-ssa-sccvn.c Richard Sandiford
2018-08-28 10:41 ` Richard Biener
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).