public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <rguenther@suse.de>
To: gcc-patches@gcc.gnu.org
Subject: [PATCH] tree-optimization/106403 - fix ICE with VN of .STORE_LANES
Date: Fri, 22 Jul 2022 08:16:22 +0000 (UTC)	[thread overview]
Message-ID: <20220722081622.rJI578S-XWTwVojoRN49LDiLR0yVkLl19b899djJMEk@z> (raw)

While .STORE_LANES is not supported by the recent VN patch we were
still accessing the stored value and valueizing it - but
internal_fn_stored_value_index does not support .STORE_LANES and
we failed to honor that case.  Fixed by simply moving the affected
code below the check for the actual supported internal functions.

Bootstrap / regtest running on x86_64-unknown-linux-gnu.

	PR tree-optimization/106403
	* tree-ssa-sccvn.cc (vn_reference_lookup_3): Move stored
	value valueization after check for IFN_MASKED_STORE or
	IFN_LEN_STORE.
---
 gcc/tree-ssa-sccvn.cc | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/gcc/tree-ssa-sccvn.cc b/gcc/tree-ssa-sccvn.cc
index 0ebbc69b502..741e6ebc4ba 100644
--- a/gcc/tree-ssa-sccvn.cc
+++ b/gcc/tree-ssa-sccvn.cc
@@ -3227,11 +3227,6 @@ vn_reference_lookup_3 (ao_ref *ref, tree vuse, void *data_,
     {
       gcall *call = as_a <gcall *> (def_stmt);
       internal_fn fn = gimple_call_internal_fn (call);
-      tree def_rhs = gimple_call_arg (call,
-				      internal_fn_stored_value_index (fn));
-      def_rhs = vn_valueize (def_rhs);
-      if (TREE_CODE (def_rhs) != VECTOR_CST)
-	return (void *)-1;
 
       tree mask = NULL_TREE, len = NULL_TREE, bias = NULL_TREE;
       switch (fn)
@@ -3251,6 +3246,12 @@ vn_reference_lookup_3 (ao_ref *ref, tree vuse, void *data_,
 	default:
 	  return (void *)-1;
 	}
+      tree def_rhs = gimple_call_arg (call,
+				      internal_fn_stored_value_index (fn));
+      def_rhs = vn_valueize (def_rhs);
+      if (TREE_CODE (def_rhs) != VECTOR_CST)
+	return (void *)-1;
+
       ao_ref_init_from_ptr_and_size (&lhs_ref,
 				     vn_valueize (gimple_call_arg (call, 0)),
 				     TYPE_SIZE_UNIT (TREE_TYPE (def_rhs)));
-- 
2.35.3

             reply	other threads:[~2022-07-22  8:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-22  8:16 Richard Biener [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-07-22  8:16 Richard Biener
2022-07-22  8:16 Richard Biener

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220722081622.rJI578S-XWTwVojoRN49LDiLR0yVkLl19b899djJMEk@z \
    --to=rguenther@suse.de \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).