* [PATCH] Add POLY_INT_CST support to fold_ctor_reference in gimple-fold.cc
@ 2023-07-31 9:42 Richard Ball
2023-07-31 9:56 ` Richard Sandiford
0 siblings, 1 reply; 3+ messages in thread
From: Richard Ball @ 2023-07-31 9:42 UTC (permalink / raw)
To: gcc-patches, richard.sandiford, richard.earnshaw, kyrylo.tkachov,
marcus.shawcroft
Add POLY_INT_CST support to code within
fold_ctor_reference. This code previously
only supported INTEGER_CST which caused a
bug when using VEC_PERM_EXPR with SVE vectors.
gcc/ChangeLog:
* gimple-fold.cc (fold_ctor_reference):
Add support for Poly_int.
#################################################
diff --git a/gcc/gimple-fold.cc b/gcc/gimple-fold.cc
index
4027ff71e10337fe49c600fcd5a80026b260d54d..91e80b9aaa3b4797ce3a94129ca42c98d974cbd9
100644
--- a/gcc/gimple-fold.cc
+++ b/gcc/gimple-fold.cc
@@ -8162,8 +8162,8 @@ fold_ctor_reference (tree type, tree ctor, const
poly_uint64 &poly_offset,
result. */
if (!AGGREGATE_TYPE_P (TREE_TYPE (ctor)) && !offset
/* VIEW_CONVERT_EXPR is defined only for matching sizes. */
- && !compare_tree_int (TYPE_SIZE (type), size)
- && !compare_tree_int (TYPE_SIZE (TREE_TYPE (ctor)), size))
+ && known_eq (wi::to_poly_widest (TYPE_SIZE (type)), size)
+ && known_eq (wi::to_poly_widest (TYPE_SIZE (TREE_TYPE (ctor))),
size))
{
ret = canonicalize_constructor_val (unshare_expr (ctor), from_decl);
if (ret)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Add POLY_INT_CST support to fold_ctor_reference in gimple-fold.cc
2023-07-31 9:42 [PATCH] Add POLY_INT_CST support to fold_ctor_reference in gimple-fold.cc Richard Ball
@ 2023-07-31 9:56 ` Richard Sandiford
2023-08-01 16:04 ` Richard Ball
0 siblings, 1 reply; 3+ messages in thread
From: Richard Sandiford @ 2023-07-31 9:56 UTC (permalink / raw)
To: Richard Ball
Cc: gcc-patches, richard.earnshaw, kyrylo.tkachov, marcus.shawcroft
Richard Ball <richard.ball@arm.com> writes:
> Add POLY_INT_CST support to code within
> fold_ctor_reference. This code previously
> only supported INTEGER_CST which caused a
> bug when using VEC_PERM_EXPR with SVE vectors.
Just to add for others: this is a prerequisite for a follow-on patch,
so the change will be tested there.
> gcc/ChangeLog:
>
> * gimple-fold.cc (fold_ctor_reference):
> Add support for Poly_int.
Nit: s/Poly_int/poly_int/
OK with that change, thanks. Please follow https://gcc.gnu.org/gitwrite.html
to get write access (I'll sponsor).
Richard
> #################################################
>
> diff --git a/gcc/gimple-fold.cc b/gcc/gimple-fold.cc
> index
> 4027ff71e10337fe49c600fcd5a80026b260d54d..91e80b9aaa3b4797ce3a94129ca42c98d974cbd9
> 100644
> --- a/gcc/gimple-fold.cc
> +++ b/gcc/gimple-fold.cc
> @@ -8162,8 +8162,8 @@ fold_ctor_reference (tree type, tree ctor, const
> poly_uint64 &poly_offset,
> result. */
> if (!AGGREGATE_TYPE_P (TREE_TYPE (ctor)) && !offset
> /* VIEW_CONVERT_EXPR is defined only for matching sizes. */
> - && !compare_tree_int (TYPE_SIZE (type), size)
> - && !compare_tree_int (TYPE_SIZE (TREE_TYPE (ctor)), size))
> + && known_eq (wi::to_poly_widest (TYPE_SIZE (type)), size)
> + && known_eq (wi::to_poly_widest (TYPE_SIZE (TREE_TYPE (ctor))),
> size))
> {
> ret = canonicalize_constructor_val (unshare_expr (ctor), from_decl);
> if (ret)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Add POLY_INT_CST support to fold_ctor_reference in gimple-fold.cc
2023-07-31 9:56 ` Richard Sandiford
@ 2023-08-01 16:04 ` Richard Ball
0 siblings, 0 replies; 3+ messages in thread
From: Richard Ball @ 2023-08-01 16:04 UTC (permalink / raw)
To: Richard Sandiford, gcc-patches
Thanks Richard,
I've gone through the write access process and committed this.
On 7/31/2023 10:56 AM, Richard Sandiford wrote:
> Richard Ball <richard.ball@arm.com> writes:
>> Add POLY_INT_CST support to code within
>> fold_ctor_reference. This code previously
>> only supported INTEGER_CST which caused a
>> bug when using VEC_PERM_EXPR with SVE vectors.
>
> Just to add for others: this is a prerequisite for a follow-on patch,
> so the change will be tested there.
>
>> gcc/ChangeLog:
>>
>> * gimple-fold.cc (fold_ctor_reference):
>> Add support for Poly_int.
>
> Nit: s/Poly_int/poly_int/
>
> OK with that change, thanks. Please follow https://gcc.gnu.org/gitwrite.html
> to get write access (I'll sponsor).
>
> Richard
>
>> #################################################
>>
>> diff --git a/gcc/gimple-fold.cc b/gcc/gimple-fold.cc
>> index
>> 4027ff71e10337fe49c600fcd5a80026b260d54d..91e80b9aaa3b4797ce3a94129ca42c98d974cbd9
>> 100644
>> --- a/gcc/gimple-fold.cc
>> +++ b/gcc/gimple-fold.cc
>> @@ -8162,8 +8162,8 @@ fold_ctor_reference (tree type, tree ctor, const
>> poly_uint64 &poly_offset,
>> result. */
>> if (!AGGREGATE_TYPE_P (TREE_TYPE (ctor)) && !offset
>> /* VIEW_CONVERT_EXPR is defined only for matching sizes. */
>> - && !compare_tree_int (TYPE_SIZE (type), size)
>> - && !compare_tree_int (TYPE_SIZE (TREE_TYPE (ctor)), size))
>> + && known_eq (wi::to_poly_widest (TYPE_SIZE (type)), size)
>> + && known_eq (wi::to_poly_widest (TYPE_SIZE (TREE_TYPE (ctor))),
>> size))
>> {
>> ret = canonicalize_constructor_val (unshare_expr (ctor), from_decl);
>> if (ret)
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-08-01 16:05 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-31 9:42 [PATCH] Add POLY_INT_CST support to fold_ctor_reference in gimple-fold.cc Richard Ball
2023-07-31 9:56 ` Richard Sandiford
2023-08-01 16:04 ` Richard Ball
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).