public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-2909] [PATCH] Add POLY_INT_CST support to fold_ctor_reference in gimple-fold.cc
@ 2023-08-01 16:00 Richard Ball
  0 siblings, 0 replies; only message in thread
From: Richard Ball @ 2023-08-01 16:00 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:7c09e7e24b0d04857d5880197959e75bda0c489e

commit r14-2909-g7c09e7e24b0d04857d5880197959e75bda0c489e
Author: Richard Ball <richard.ball@arm.com>
Date:   Tue Aug 1 16:57:02 2023 +0100

    [PATCH] Add POLY_INT_CST support to fold_ctor_reference in gimple-fold.cc
    
    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:
---
 gcc/gimple-fold.cc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gcc/gimple-fold.cc b/gcc/gimple-fold.cc
index 86b83472a61..fd01810581a 100644
--- a/gcc/gimple-fold.cc
+++ b/gcc/gimple-fold.cc
@@ -8159,8 +8159,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] only message in thread

only message in thread, other threads:[~2023-08-01 16:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-01 16:00 [gcc r14-2909] [PATCH] Add POLY_INT_CST support to fold_ctor_reference in gimple-fold.cc 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).