From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1666) id 579A03858C36; Fri, 23 Jun 2023 09:23:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 579A03858C36 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1687512231; bh=hj6N+oAT09zsHOiVFmP/kd+PfV+mZTGrtKCiBIw1pto=; h=From:To:Subject:Date:From; b=IUELc9Ps1U5HzzFVnKb01tdfPdStQowLt5IDbw0eazb3+4GJ5fAn66hZNod5gFJzn 7QFiJLFpArcAo3Ivy2VIW8kVAQI7VRVT85MIZX80+6Zy+fXfph1U9VkcShczeRUn2u XI2ue7UOh/tZAqtegX8nQoNb+FKoMkDJ65mlV358= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Richard Biener To: gcc-cvs@gcc.gnu.org Subject: [gcc r14-2042] Properly guard vect_look_through_possible_promotion X-Act-Checkin: gcc X-Git-Author: Richard Biener X-Git-Refname: refs/heads/master X-Git-Oldrev: 1fe09b90f856ba27c3e44dda156b28adb5d4d8ea X-Git-Newrev: 4127e0f3313c961b4b4e5efad85a25c40c2510c2 Message-Id: <20230623092351.579A03858C36@sourceware.org> Date: Fri, 23 Jun 2023 09:23:51 +0000 (GMT) List-Id: https://gcc.gnu.org/g:4127e0f3313c961b4b4e5efad85a25c40c2510c2 commit r14-2042-g4127e0f3313c961b4b4e5efad85a25c40c2510c2 Author: Richard Biener Date: Fri Jun 23 10:08:50 2023 +0200 Properly guard vect_look_through_possible_promotion The function ends up getting called on VECTOR_TYPEs which it really isn't prepared for and with the TYPE_PRECISION checking changes will ICE. The following exits early when the type to work on isn't scalar integral. * tree-vect-patterns.cc (vect_look_through_possible_promotion): Exit early when the type isn't scalar integral. Diff: --- gcc/tree-vect-patterns.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gcc/tree-vect-patterns.cc b/gcc/tree-vect-patterns.cc index 60bc9be6819..a04accf3b03 100644 --- a/gcc/tree-vect-patterns.cc +++ b/gcc/tree-vect-patterns.cc @@ -398,8 +398,11 @@ vect_look_through_possible_promotion (vec_info *vinfo, tree op, vect_unpromoted_value *unprom, bool *single_use_p = NULL) { - tree res = NULL_TREE; tree op_type = TREE_TYPE (op); + if (!INTEGRAL_TYPE_P (op_type)) + return NULL_TREE; + + tree res = NULL_TREE; unsigned int orig_precision = TYPE_PRECISION (op_type); unsigned int min_precision = orig_precision; stmt_vec_info caster = NULL; @@ -3881,6 +3884,7 @@ vect_recog_vector_vector_shift_pattern (vec_info *vinfo, if (TREE_CODE (oprnd0) != SSA_NAME || TREE_CODE (oprnd1) != SSA_NAME || TYPE_MODE (TREE_TYPE (oprnd0)) == TYPE_MODE (TREE_TYPE (oprnd1)) + || !INTEGRAL_TYPE_P (TREE_TYPE (oprnd0)) || !type_has_mode_precision_p (TREE_TYPE (oprnd1)) || TYPE_PRECISION (TREE_TYPE (lhs)) != TYPE_PRECISION (TREE_TYPE (oprnd0)))