From patchwork Wed May 17 06:05:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kewen.Lin" X-Patchwork-Id: 95060 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp907655vqo; Tue, 16 May 2023 23:06:56 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ40mW3j93iZqKrH2096hZQ2M++BAtFpDCApsr4UjqHustUrf5fZx3wFLG5RzWgSCOuQKvIy X-Received: by 2002:a17:907:728d:b0:96a:5bdd:7557 with SMTP id dt13-20020a170907728d00b0096a5bdd7557mr21184910ejc.70.1684303616554; Tue, 16 May 2023 23:06:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684303616; cv=none; d=google.com; s=arc-20160816; b=T1MhN9MYun0+c1tc0eynP0Jx5QqY4fKY0y/XUZjy1zM4NQ/Up61USpAa7nqPnp0b0X sLMgjwEL2HwgW9zllt1WMZ6G1iuXFBC9wECtSOHoQIK3BDPRv8Gx6MjISIiHQyhsFjXO Z0/SYheaGvyh0q8f/jlVFdZVu+/U82w83BrhPYYb8nNIyF/vAU89y0EWGByEmypeHAPl i+32ZcJnHjU7r4+Vvm7QAHlHzhU0JvLd3xqQuQKKhwKBfuzCqaya0FZB+m8pOklSDP/L bsj18MubIWTbiT3PGg4geljbfdN04sxoZKJMg8FVMY18gCLsNqzmtyJgKhmgbg0QHiQD 2KCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:cc:to:subject:content-language:user-agent :mime-version:date:message-id:dmarc-filter:delivered-to :dkim-signature:dkim-filter; bh=KEOlDZTeDmyiI/ZWXYagcKdgNKinrZ4/YkNPwkHq2wM=; b=a4qeq8dMqxx2x38a8Ys9xPsX9yWEZQFvuMeRfbeuVLvQ1O27qi1iOELEX0mst6Ei3t v2TXc4ArnnFYjrVb0CG6fZHDb/Myi3tf6RAX9VW3TxHOcrFaRQs40/kqr8GS/Hz7jAvV Mqo5GmBMMKx0kAcFZokAqqUH1JFWU5toRrK8bWZN6tOADP70ALAW0bIL7yMkwMJvlsrb uSHQoS38hZJ+e7/2lXDVUruY0I7ASInT0k/hzm+TBTJYjr9kK1jDd3/05XUG7XrF7Jvm ulXAa41ac9Irp8DM+xvie5Qz2Yc9YDO+LVzuzs7LZWHj1nNe9bd3nC7Fwy1QnHXe1ncj LG4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=cl3UaaGy; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id b13-20020a170906038d00b0094f95d214d4si16142028eja.234.2023.05.16.23.06.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 May 2023 23:06:56 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=cl3UaaGy; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7E8513858D1E for ; Wed, 17 May 2023 06:06:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7E8513858D1E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1684303615; bh=KEOlDZTeDmyiI/ZWXYagcKdgNKinrZ4/YkNPwkHq2wM=; h=Date:Subject:To:Cc:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=cl3UaaGyJqFrmVMC2IspN1JgqEB8X/SFjhO2y6gr6AecZY0d8yBkG5/aYSjE/yujl 550jL1tpt3CQ3p43Li8tBiVceu1PUax81mmIGDogW2ZTj+Qy9/2lJ6xyU+vFje22RS f9m/W/LCazhcBzZMSaAs4FprcvD50uccrAhWN/sI= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by sourceware.org (Postfix) with ESMTPS id 2679D3858D1E for ; Wed, 17 May 2023 06:06:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2679D3858D1E Received: from pps.filterd (m0353728.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 34H5wlwe026331; Wed, 17 May 2023 06:06:03 GMT Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3qmqwnjgee-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 17 May 2023 06:06:02 +0000 Received: from m0353728.ppops.net (m0353728.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 34H65Xs4011215; Wed, 17 May 2023 06:06:02 GMT Received: from ppma05fra.de.ibm.com (6c.4a.5195.ip4.static.sl-reverse.com [149.81.74.108]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3qmqwnjgc2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 17 May 2023 06:06:01 +0000 Received: from pps.filterd (ppma05fra.de.ibm.com [127.0.0.1]) by ppma05fra.de.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 34H4nZX6017055; Wed, 17 May 2023 06:05:59 GMT Received: from smtprelay03.fra02v.mail.ibm.com ([9.218.2.224]) by ppma05fra.de.ibm.com (PPS) with ESMTPS id 3qj264snsd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 17 May 2023 06:05:59 +0000 Received: from smtpav05.fra02v.mail.ibm.com (smtpav05.fra02v.mail.ibm.com [10.20.54.104]) by smtprelay03.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 34H65vtd20185618 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 17 May 2023 06:05:57 GMT Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 24B322004B; Wed, 17 May 2023 06:05:57 +0000 (GMT) Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1BFDC20040; Wed, 17 May 2023 06:05:55 +0000 (GMT) Received: from [9.177.81.160] (unknown [9.177.81.160]) by smtpav05.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 17 May 2023 06:05:54 +0000 (GMT) Message-ID: Date: Wed, 17 May 2023 14:05:53 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 Content-Language: en-US Subject: [PATCH] vect: Don't retry if the previous analysis fails To: GCC Patches Cc: Richard Biener , Richard Sandiford , Segher Boessenkool , Peter Bergner X-TM-AS-GCONF: 00 X-Proofpoint-GUID: azhaGhGH9A51H-VX7kkCoFG7cSNNjxA2 X-Proofpoint-ORIG-GUID: i7LE2zwqkYc-TRoaKIVcZtq_QzNjaVha X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-05-16_14,2023-05-16_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 impostorscore=0 bulkscore=0 lowpriorityscore=0 mlxlogscore=999 priorityscore=1501 phishscore=0 malwarescore=0 spamscore=0 mlxscore=0 suspectscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2304280000 definitions=main-2305170051 X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: "Kewen.Lin via Gcc-patches" From: "Kewen.Lin" Reply-To: "Kewen.Lin" Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766120349315564985?= X-GMAIL-MSGID: =?utf-8?q?1766120349315564985?= Hi, When working on a cost tweaking patch, I found that a newly added test case has different dumpings with stage-1 and bootstrapped gcc. By looking into it, the apparent reason is vect_analyze_loop_2 doesn't get slp_done_for_suggested_uf set expectedly, the following retrying will use the garbage slp_done_for_suggested_uf instead. In fact, the setting of slp_done_for_suggested_uf only happens when the previous analysis succeeds, for the mentioned test case, its previous analysis does fail, it's unexpected to use the value of slp_done_for_suggested_uf any more. In function vect_analyze_loop_1, we only return success when res is true, which is the result of 1st analysis. It means we never try to vectorize with unroll_vinfo if the previous analysis fails. So this patch shouldn't break anything, and just stop some useless analysis early. Bootstrapped and regtested on x86_64-redhat-linux, aarch64-linux-gnu and powerpc64{,le}-linux-gnu. Is it ok for trunk? BR, Kewen ----- gcc/ChangeLog: * tree-vect-loop.cc (vect_analyze_loop_1): Don't retry analysis with suggested unroll factor once the previous analysis fails. --- gcc/tree-vect-loop.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.31.1 diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc index ed0166fedab..905145ae97b 100644 --- a/gcc/tree-vect-loop.cc +++ b/gcc/tree-vect-loop.cc @@ -3044,7 +3044,7 @@ vect_analyze_loop_1 (class loop *loop, vec_info_shared *shared, res ? "succeeded" : " failed", GET_MODE_NAME (loop_vinfo->vector_mode)); - if (!main_loop_vinfo && suggested_unroll_factor > 1) + if (res && !main_loop_vinfo && suggested_unroll_factor > 1) { if (dump_enabled_p ()) dump_printf_loc (MSG_NOTE, vect_location,