From patchwork Wed Feb 10 22:29:26 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 581707 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4090014030C for ; Thu, 11 Feb 2016 09:29:41 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=s652MZOA; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:reply-to:mime-version :content-type; q=dns; s=default; b=VRGSiCjk4odqneAAbhqKT4QVBawHT 5nVX6L9Vy0stLaO1ecL5J5lAsSBoJJBIoubcyba9TZXxlwVCA8R0nPqJ9A5+z/I/ aq3seIn2DnzjW6ckp9xlGslVdbUahZd5F3/cFMARxpYeaa3K4AmdZVIINlFa42G0 582ggkOrWHRfHc= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:reply-to:mime-version :content-type; s=default; bh=XZzqe+NecQgneTmYSutClDWxLzM=; b=s65 2MZOAFUxpj94twj5UlaE6ZaTvCtEeqjYmdlEyLYxYlZVwcO7FjObEhLp8YUhXJ7b xJgDNEF75XIYPAwhCWOOvrRSUXSVhFSSAaS/Tj1GYk7+v8B5piBfz9Si1bNBUNaQ EKFDqrJoUlp7AhCRzNoSwi3bhEPExj41XXRt3y9Q= Received: (qmail 4933 invoked by alias); 10 Feb 2016 22:29:34 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 4922 invoked by uid 89); 10 Feb 2016 22:29:33 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Wed, 10 Feb 2016 22:29:33 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id D7642C0A9CCB; Wed, 10 Feb 2016 22:29:31 +0000 (UTC) Received: from tucnak.zalov.cz ([10.3.113.11]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u1AMTU4X019779 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 10 Feb 2016 17:29:31 -0500 Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.15.2/8.15.2) with ESMTP id u1AMTS90001124; Wed, 10 Feb 2016 23:29:28 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id u1AMTQ4I001123; Wed, 10 Feb 2016 23:29:26 +0100 Date: Wed, 10 Feb 2016 23:29:26 +0100 From: Jakub Jelinek To: Richard Biener Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] Fix unnecessary -Wmaybe-uninitialized false positive (PR target/65313) Message-ID: <20160210222926.GX3017@tucnak.redhat.com> Reply-To: Jakub Jelinek MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) X-IsSubscribed: yes Hi! During profiledbootstrap on ppc64 I've noticed a -Wmaybe-uninitialized warning in vect_schedule_slp_instance, when built with -fprofile-generate. While it is clearly a false positive, IMHO it is completely unnecessary to use here two variables, one uninitialized, another bool whether it is initialized. In valid code gimple_assign_rhs_code should not return ERROR_MARK, so we can use ocode == ERROR_MARK for the allsame case and ocode != ERROR_MARK for !allsame. Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2016-02-10 Jakub Jelinek PR target/65313 * tree-vect-slp.c (vect_schedule_slp_instance): Avoid -Wmaybe-uninitialized warning. Jakub --- gcc/tree-vect-slp.c.jj 2016-01-21 13:54:19.000000000 +0100 +++ gcc/tree-vect-slp.c 2016-02-09 13:40:30.280769470 +0100 @@ -3568,20 +3568,18 @@ vect_schedule_slp_instance (slp_tree nod if (SLP_TREE_TWO_OPERATORS (node)) { enum tree_code code0 = gimple_assign_rhs_code (stmt); - enum tree_code ocode; + enum tree_code ocode = ERROR_MARK; gimple *ostmt; unsigned char *mask = XALLOCAVEC (unsigned char, group_size); - bool allsame = true; FOR_EACH_VEC_ELT (SLP_TREE_SCALAR_STMTS (node), i, ostmt) if (gimple_assign_rhs_code (ostmt) != code0) { mask[i] = 1; - allsame = false; ocode = gimple_assign_rhs_code (ostmt); } else mask[i] = 0; - if (!allsame) + if (ocode != ERROR_MARK) { vec v0; vec v1;