From patchwork Wed Jan 16 22:49:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 1026247 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-494190-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="RixNTwL8"; dkim-atps=neutral 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 43g2T36PCqz9sLt for ; Thu, 17 Jan 2019 09:49:27 +1100 (AEDT) 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=hOdq1ORhht+s4g2lasPRbGPy8H0ZO 0/xkFkGup3/Aet3QdY+38cUhlWEizxtjyW948roxd68Lut8MzrE5NJ75Kx2TzPn7 HrUpqTEdJLP1PUunEeMzUXuoqHVgq1l23k0fv6wiNC2NuoN1YeJQ3TvLcxkyRpm4 36M0c0TJcyLXcE= 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=SHVtsl8pPSKWo3rhfqcbDyWmCH4=; b=Rix NTwL8Vx9oPKdl9J3Cn3990P+cVifnP7/x6iQWOsdzm75wFHiXKP8nRFPbxC8f4NW NChYcLhe4D9oHeQ+VmOsTprEM23FbOTsQrSq3gCsPHkGpJPASLUoGEjZgO1By/kL J3pjgckiqaei9tHFDvsrlTDwU/k54HaSxLE5kfHc= Received: (qmail 22983 invoked by alias); 16 Jan 2019 22:49:09 -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 22859 invoked by uid 89); 16 Jan 2019 22:49:08 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-10.9 required=5.0 tests=BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1655 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 ESMTP; Wed, 16 Jan 2019 22:49:06 +0000 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3569C88311; Wed, 16 Jan 2019 22:49:05 +0000 (UTC) Received: from tucnak.zalov.cz (ovpn-116-69.ams2.redhat.com [10.36.116.69]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D01B5101960A; Wed, 16 Jan 2019 22:49:04 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.15.2/8.15.2) with ESMTP id x0GMn2Pb031021; Wed, 16 Jan 2019 23:49:02 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id x0GMn1Lq031020; Wed, 16 Jan 2019 23:49:01 +0100 Date: Wed, 16 Jan 2019 23:49:01 +0100 From: Jakub Jelinek To: Richard Biener Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] Don't add unnecessary var self-conflicts (PR tree-optimization/86214) Message-ID: <20190116224901.GB30353@tucnak> Reply-To: Jakub Jelinek MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) X-IsSubscribed: yes Hi! While looking at this PR (I've just started) I've noticed that add_stack_var_conflict is quite often called with x == y. We don't really need to record that a variable conflicts with itself, the only reader of the conflicts bitmaps, stack_var_conflict_p, starts with if (x == y) return false; conflicts bitmap are set either by this function, or by the EXECUTE_IF_SET_IN_BITMAP (work, 0, i, bi) { struct stack_var *a = &stack_vars[i]; if (!a->conflicts) a->conflicts = BITMAP_ALLOC (&stack_var_bitmap_obstack); bitmap_ior_into (a->conflicts, work); } code (where work isn't derived from any conflicts bitmap though, so doesn't care if we've added those self-conflicts or not). The above bitmap_ior_into stuff actually always sets self-conflicts (if you think bitmap_clear_bit is worth it, I can add it afterwards though). But I think the following patch is helpful, don't create the conflicts bitmaps at all if all we'd record is just self-conflict which we'll ignore. Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2019-01-16 Jakub Jelinek PR tree-optimization/86214 * cfgexpand.c (add_stack_var_conflict): Don't add any conflicts if x == y. Jakub --- gcc/cfgexpand.c.jj 2019-01-16 09:35:09.131247513 +0100 +++ gcc/cfgexpand.c 2019-01-16 20:14:11.445467399 +0100 @@ -470,6 +470,8 @@ add_stack_var_conflict (size_t x, size_t { struct stack_var *a = &stack_vars[x]; struct stack_var *b = &stack_vars[y]; + if (x == y) + return; if (!a->conflicts) a->conflicts = BITMAP_ALLOC (&stack_var_bitmap_obstack); if (!b->conflicts)