public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Make sure SCALAR_INT_MODE_P before invoke try_const_anchors
@ 2023-06-09  5:28 Jiufu Guo
  2023-06-09  8:00 ` Richard Biener
  0 siblings, 1 reply; 14+ messages in thread
From: Jiufu Guo @ 2023-06-09  5:28 UTC (permalink / raw)
  To: gcc-patches
  Cc: rguenther, jeffreyalaw, richard.sandiford, segher, dje.gcc,
	linkw, bergner, guojiufu

Hi,

As checking the code, there is a "gcc_assert (SCALAR_INT_MODE_P (mode))"
in "try_const_anchors".
This assert seems correct because the function try_const_anchors cares
about integer values currently, and modes other than SCALAR_INT_MODE_P
are not needed to support.

This patch makes sure SCALAR_INT_MODE_P when calling try_const_anchors.

This patch is raised when drafting below one.
https://gcc.gnu.org/pipermail/gcc-patches/2022-October/603530.html.
With that patch, "{[%1:DI]=0;} stack_tie" with BLKmode runs into
try_const_anchors, and hits the assert/ice.

Boostrap and regtest pass on ppc64{,le} and x86_64.
Is this ok for trunk?


BR,
Jeff (Jiufu Guo)

gcc/ChangeLog:

	* cse.cc (cse_insn): Add SCALAR_INT_MODE_P condition.

---
 gcc/cse.cc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gcc/cse.cc b/gcc/cse.cc
index 2bb63ac4105..f213fa0faf7 100644
*** a/gcc/cse.cc
--- b/gcc/cse.cc
***************
*** 5003,5009 ****
        if (targetm.const_anchor
  	  && !src_related
  	  && src_const
! 	  && GET_CODE (src_const) == CONST_INT)
  	{
  	  src_related = try_const_anchors (src_const, mode);
  	  src_related_is_const_anchor = src_related != NULL_RTX;
- - 
--- 5003,5010 ----
        if (targetm.const_anchor
  	  && !src_related
  	  && src_const
! 	  && GET_CODE (src_const) == CONST_INT
! 	  && SCALAR_INT_MODE_P (mode))
  	{
  	  src_related = try_const_anchors (src_const, mode);
  	  src_related_is_const_anchor = src_related != NULL_RTX;
2.39.3


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2023-06-13  2:34 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-09  5:28 [PATCH] Make sure SCALAR_INT_MODE_P before invoke try_const_anchors Jiufu Guo
2023-06-09  8:00 ` Richard Biener
2023-06-09  8:24   ` guojiufu
2023-06-09  8:33     ` Richard Sandiford
2023-06-09  8:51       ` Richard Biener
2023-06-09  9:10         ` Jiufu Guo
2023-06-09 10:57           ` Richard Biener
2023-06-09 12:43             ` Jiufu Guo
2023-06-09 12:52               ` Richard Biener
2023-06-12  5:44                 ` Jiufu Guo
2023-06-12  8:02                   ` Richard Biener
2023-06-12 11:20                     ` Jiufu Guo
2023-06-12 20:54                   ` Jeff Law
2023-06-13  2:34                     ` Jiufu 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).