From patchwork Wed Jul 3 08:42:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Hu, Lin1" X-Patchwork-Id: 93280 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 0738E3860C34 for ; Wed, 3 Jul 2024 08:44:58 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.20]) by sourceware.org (Postfix) with ESMTPS id 5E0D63860744; Wed, 3 Jul 2024 08:44:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5E0D63860744 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=intel.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 5E0D63860744 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=198.175.65.20 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1719996267; cv=none; b=gTiiLmPAF8fQY7vjwef9ZHio5+f7+6WGIu6C6ULNk9+lpekXKIxIwv2YS2IQ74MHeHIvC+AXsGa3qv37aBfJOKcN2aCwyiEzpkExcXWBc3XlYz34fOH/rBeMXwaG6hUeBT4hVZFZT1oKsfpajXp4PJgFAmhlzkGmUf2gpNimk+w= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1719996267; c=relaxed/simple; bh=Gi2UxEB4U2H4XemDBL4Lo1flT2hVqtqgtJgaUqZ/diA=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=fQKcHgdt6Tsbdt8YQssnD9Oji/+g6SYy8PcqVvQcfLE3NIA8OWrkHgzlnuoeDR3ILX0ZzXUNNKM7pE4jBsw1dXKMWhIhC5afmsau/dsLaFABsjNeb86Tw77lAOnMtmZ6HxKDZJjLm95JiKZtUBeFq960O99xzoksPFBOswROxrM= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1719996265; x=1751532265; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=Gi2UxEB4U2H4XemDBL4Lo1flT2hVqtqgtJgaUqZ/diA=; b=Cz6mh3SdHH1HSEjQSoTNyesjdkp4MYHnnKha3BZlsRThAe3Y8CtllHtc DNqhpGPON7VmxHt3ZCgFGi37+gYZXnDwURsdZvg0JxpSAlroe79nsUTYq xUArhvKBlLycM20AmVgV+shgMNNev8HjOKRGUCPYdGGgBiUCJlVgCyxdS cGaJntu51Tw6JiDiqIpNCcI3BOXHqSICLpz+/MEueoYI557GQ6Kfwg6N0 uYQr50KqHaLDLVEW2t6FZtxIRHJ+L/5sFeNK5tRbKbOyMkp5egcaTNLB8 kNpezwvYCf9yD+M49MhyLIiSrSea1ABUlBOLzaboyjk8X5V5yecxKmeOM w==; X-CSE-ConnectionGUID: UOgZgzvjR42eG8TdDiy5Ng== X-CSE-MsgGUID: 93NWvADIRp+5I4FpiLj/Ww== X-IronPort-AV: E=McAfee;i="6700,10204,11121"; a="17037810" X-IronPort-AV: E=Sophos;i="6.09,181,1716274800"; d="scan'208";a="17037810" Received: from orviesa008.jf.intel.com ([10.64.159.148]) by orvoesa112.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Jul 2024 01:44:23 -0700 X-CSE-ConnectionGUID: BIc328VgRq6W4ScjSgLkgA== X-CSE-MsgGUID: vihAW/fzRjinCQfCh7hY4g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,181,1716274800"; d="scan'208";a="46931168" Received: from shvmail03.sh.intel.com ([10.239.245.20]) by orviesa008.jf.intel.com with ESMTP; 03 Jul 2024 01:44:21 -0700 Received: from shliclel4217.sh.intel.com (shliclel4217.sh.intel.com [10.239.240.127]) by shvmail03.sh.intel.com (Postfix) with ESMTP id 273571005670; Wed, 3 Jul 2024 16:44:20 +0800 (CST) From: "Hu, Lin1" To: gcc-patches@gcc.gnu.org Cc: hongtao.liu@intel.com, ubizjak@gmail.com, rguenther@suse.de, zsojka@seznam.cz, pinskia@gcc.gnu.org Subject: [PATCH] vect: Fix ICE caused by missing check for TREE_CODE == SSA_NAME Date: Wed, 3 Jul 2024 16:42:20 +0800 Message-Id: <20240703084220.686122-1-lin1.hu@intel.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-Spam-Status: No, score=-10.7 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~patchwork=sourceware.org@gcc.gnu.org Hi, all I forgot to check if the tree's code is SSA_NAME. Have modified. Bootstrapped and regtested on {x86-64, aarch64}-linux-gnu, OK for trunk? BRs, Lin 2024-07-03 Hu, Lin1 Andrew Pinski gcc/ChangeLog: PR tree-optimization/115753 * tree-vect-stmts.cc (supportable_indirect_convert_operation): Add TYPE_CODE check before SSA_NAME_RANGE_INFO. gcc/testsuite/ChangeLog: PR tree-optimization/115753 * gcc.dg/vect/pr115753-1.c: New test. * gcc.dg/vect/pr115753-2.c: Ditto. * gcc.dg/vect/pr115753-3.c: Ditto. --- gcc/testsuite/gcc.dg/vect/pr115753-1.c | 12 ++++++++++++ gcc/testsuite/gcc.dg/vect/pr115753-2.c | 20 ++++++++++++++++++++ gcc/testsuite/gcc.dg/vect/pr115753-3.c | 15 +++++++++++++++ gcc/tree-vect-stmts.cc | 2 +- 4 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/vect/pr115753-1.c create mode 100644 gcc/testsuite/gcc.dg/vect/pr115753-2.c create mode 100644 gcc/testsuite/gcc.dg/vect/pr115753-3.c diff --git a/gcc/testsuite/gcc.dg/vect/pr115753-1.c b/gcc/testsuite/gcc.dg/vect/pr115753-1.c new file mode 100644 index 00000000000..2c1b6e5df63 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr115753-1.c @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -frounding-math" } */ +/* { dg-add-options float16 } */ +/* { dg-require-effective-target float16 } */ + +void f(_Complex _Float16*); +void +foo1 (_Complex _Float16 *d) +{ + _Complex _Float16 cf = 3967 + 3791 * 1i; + f(&cf); +} diff --git a/gcc/testsuite/gcc.dg/vect/pr115753-2.c b/gcc/testsuite/gcc.dg/vect/pr115753-2.c new file mode 100644 index 00000000000..ceacada2a76 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr115753-2.c @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -frounding-math" } */ +/* { dg-add-options float16 } */ +/* { dg-require-effective-target float16 } */ + +void f(_Float16*); +void +foo1 () +{ + int t0 = 3967; + int t1 = 3969; + int t2 = 3971; + int t3 = 3973; + _Float16 tt[4]; + tt[0] = t0; + tt[1] = t1; + tt[2] = t2; + tt[3] = t3; + f(&tt[0]); +} diff --git a/gcc/testsuite/gcc.dg/vect/pr115753-3.c b/gcc/testsuite/gcc.dg/vect/pr115753-3.c new file mode 100644 index 00000000000..8e95445897c --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr115753-3.c @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -frounding-math" } */ + +void f(float*); +void +foo1 () +{ + long long t0 = __LONG_LONG_MAX__; + long long t1 = __LONG_LONG_MAX__ - 1; + float tt[2]; + tt[0] = t0; + tt[1] = t1; + f(&tt[0]); +} + diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc index 20b84515446..b4f346ee6ab 100644 --- a/gcc/tree-vect-stmts.cc +++ b/gcc/tree-vect-stmts.cc @@ -14678,7 +14678,7 @@ supportable_indirect_convert_operation (code_helper code, In the future, if it is supported, changes may need to be made to this part, such as checking the RANGE of each element in the vector. */ - if (!SSA_NAME_RANGE_INFO (op0) + if ((TREE_CODE (op0) == SSA_NAME && !SSA_NAME_RANGE_INFO (op0)) || !vect_get_range_info (op0, &op_min_value, &op_max_value)) break;