public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-1918] Check SCALAR_INT_MODE_P in try_const_anchors
@ 2023-06-19  2:45 Jiu Fu Guo
  0 siblings, 0 replies; only message in thread
From: Jiu Fu Guo @ 2023-06-19  2:45 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:c0bd79300e8fad52ec0fac7c65838a525d544a25

commit r14-1918-gc0bd79300e8fad52ec0fac7c65838a525d544a25
Author: Jiufu Guo <guojiufu@linux.ibm.com>
Date:   Fri Jun 9 16:30:54 2023 +0800

    Check SCALAR_INT_MODE_P in try_const_anchors
    
    The const_anchor in cse.cc supports integer constants only.
    There is a "gcc_assert (SCALAR_INT_MODE_P (mode))" in
    try_const_anchors.
    
    In the latest code, some non-integer modes are used with const int.
    For examples:
    "set (mem/c:BLK (xx) (const_int 0 [0])" occur in md files of
    rs6000, i386, arm, and pa. For this, the mode may be BLKmode.
    Pattern "(set (strict_low_part (xx)) (const_int xx))" could
    be generated in a few ports. For this, the mode may be VOIDmode.
    
    So, avoid mode other than SCALAR_INT_MODE in try_const_anchors
    would be needed.
    
    Some discussions in the previous thread:
    https://gcc.gnu.org/pipermail/gcc-patches/2023-June/621097.html
    
    gcc/ChangeLog:
    
            * cse.cc (try_const_anchors): Check SCALAR_INT_MODE.

Diff:
---
 gcc/cse.cc | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/gcc/cse.cc b/gcc/cse.cc
index 6f2e0d43185..c46870059e6 100644
--- a/gcc/cse.cc
+++ b/gcc/cse.cc
@@ -1312,11 +1312,10 @@ try_const_anchors (rtx src_const, machine_mode mode)
   rtx lower_exp = NULL_RTX, upper_exp = NULL_RTX;
   unsigned lower_old, upper_old;
 
-  /* CONST_INT is used for CC modes, but we should leave those alone.  */
-  if (GET_MODE_CLASS (mode) == MODE_CC)
+  /* CONST_INT may be in various modes, avoid non-scalar-int mode. */
+  if (!SCALAR_INT_MODE_P (mode))
     return NULL_RTX;
 
-  gcc_assert (SCALAR_INT_MODE_P (mode));
   if (!compute_const_anchors (src_const, &lower_base, &lower_offs,
 			      &upper_base, &upper_offs))
     return NULL_RTX;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-06-19  2:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-19  2:45 [gcc r14-1918] Check SCALAR_INT_MODE_P in try_const_anchors Jiu Fu Guo

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).