From patchwork Thu Mar 25 06:04:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kewen.Lin" X-Patchwork-Id: 1458152 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=JJGNn3A4; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4F5ZM26YqWz9sRN for ; Thu, 25 Mar 2021 17:04:45 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 647A8385780D; Thu, 25 Mar 2021 06:04:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 647A8385780D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1616652277; bh=qrAH9fq6kWXC8mOkQ67wLEqVXo8vIM7f978wGBpO+9w=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=JJGNn3A4Oz5Ay1NAYZ47fmkw4KvonDlnKghBuWtfwDOGAVBtUufJ9GXUrkvGM2cbQ 47XKi2gwRIj4d3t4r+A/GhBIODuwx888zF63vq5Gb5MvoSzxEUAgOjAguCm0i6/foM mjvQYa4TdT/eC3BgJa7H5J5S0ZRd9jC6ckTwdyZ8= 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 2BDD23857C50 for ; Thu, 25 Mar 2021 06:04:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 2BDD23857C50 Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 12P64Xus159785 for ; Thu, 25 Mar 2021 02:04:34 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 37g8yjruqm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 25 Mar 2021 02:04:34 -0400 Received: from m0098396.ppops.net (m0098396.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 12P64Xi8159783 for ; Thu, 25 Mar 2021 02:04:33 -0400 Received: from ppma04ams.nl.ibm.com (63.31.33a9.ip4.static.sl-reverse.com [169.51.49.99]) by mx0a-001b2d01.pphosted.com with ESMTP id 37g8yjrupp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 25 Mar 2021 02:04:33 -0400 Received: from pps.filterd (ppma04ams.nl.ibm.com [127.0.0.1]) by ppma04ams.nl.ibm.com (8.16.0.43/8.16.0.43) with SMTP id 12P633Zs001758; Thu, 25 Mar 2021 06:04:29 GMT Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by ppma04ams.nl.ibm.com with ESMTP id 37d99rd1hu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 25 Mar 2021 06:04:29 +0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 12P64R6N20775382 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 25 Mar 2021 06:04:27 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 71CA311C050; Thu, 25 Mar 2021 06:04:27 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7DB9711C04A; Thu, 25 Mar 2021 06:04:26 +0000 (GMT) Received: from KewenLins-MacBook-Pro.local (unknown [9.197.249.30]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 25 Mar 2021 06:04:26 +0000 (GMT) To: GCC Patches Subject: [PATCH] vect: Init inside_cost in vect_model_reduction_cost Message-ID: <73b8262f-ab6f-b2f4-2011-86582f217890@linux.ibm.com> Date: Thu, 25 Mar 2021 14:04:24 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 MIME-Version: 1.0 Content-Language: en-US X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369, 18.0.761 definitions=2021-03-25_01:2021-03-24, 2021-03-25 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 adultscore=0 priorityscore=1501 bulkscore=0 clxscore=1015 mlxscore=0 spamscore=0 lowpriorityscore=0 impostorscore=0 phishscore=0 malwarescore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2103250046 X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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@gcc.gnu.org Sender: "Gcc-patches" Hi, I happened to find this possible use of uninitialized inside_cost during checking the cost for reduction. Before r11-6587, all the if/else if/else arms will assign values to inside_cost, so it was fine. But from r11-6587 the else path won't assign any more, it leads the inside_cost possibly uninitialized for later use. Note that it won't have any functionality issues, just could show one unreasonable cost in dump file. This is a trivial fix and I guess it can be counted as obvious, but I'm not sure if it's ok in stage 4. So is it ok for trunk? BR, Kewen ----- gcc/ChangeLog: * tree-vect-loop.c (vect_model_reduction_cost): Init inside_cost. diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c index 3e973e774af..38d96fc1634 100644 --- a/gcc/tree-vect-loop.c +++ b/gcc/tree-vect-loop.c @@ -4465,7 +4465,7 @@ vect_model_reduction_cost (loop_vec_info loop_vinfo, vect_reduction_type reduction_type, int ncopies, stmt_vector_for_cost *cost_vec) { - int prologue_cost = 0, epilogue_cost = 0, inside_cost; + int prologue_cost = 0, epilogue_cost = 0, inside_cost = 0; enum tree_code code; optab optab; tree vectype;