From patchwork Wed Jan 27 21:01:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Vladimir Makarov X-Patchwork-Id: 1432371 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=jlRdg4kK; 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 4DQwxs4VZ0z9sSs for ; Thu, 28 Jan 2021 08:01:19 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1E6593896C3D; Wed, 27 Jan 2021 21:01:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1E6593896C3D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1611781274; bh=QLZZms9GG0V5K5vOjeRcM4H95tKZQea0RoORj5u1BD4=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=jlRdg4kK10MYVhgXZcph88qvqj0+zvIE/+D6Be0oJfHjI6eHWFYTk0uJg3tVeh4EX TTl0SGgz5uR4fq7cHNO+RqpykVa3fJMWHKEMCt5ms0E2xIQqQCfoEwfeGNx0yXL55W TUKHBzGRZ5ItNVzlkr824EXcSH3tBx3UdJTbguwk= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by sourceware.org (Postfix) with ESMTP id 121F63858039 for ; Wed, 27 Jan 2021 21:01:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 121F63858039 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-525-n2VKjj1vPpKJKMl5XpNQNQ-1; Wed, 27 Jan 2021 16:01:06 -0500 X-MC-Unique: n2VKjj1vPpKJKMl5XpNQNQ-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BD13F107ACE3 for ; Wed, 27 Jan 2021 21:01:05 +0000 (UTC) Received: from [10.10.112.156] (ovpn-112-156.rdu2.redhat.com [10.10.112.156]) by smtp.corp.redhat.com (Postfix) with ESMTP id 835165D9C6 for ; Wed, 27 Jan 2021 21:01:05 +0000 (UTC) To: "gcc-patches@gcc.gnu.org" Subject: [committed] [PR97684] IRA: Recalculate pseudo classes if we added new pseduos since last calculation before updating equiv regs Message-ID: Date: Wed, 27 Jan 2021 16:01:05 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US X-Spam-Status: No, score=-13.8 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, 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: Vladimir Makarov via Gcc-patches From: Vladimir Makarov Reply-To: Vladimir Makarov Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" The patch solves the following problem:   https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97684 The patch was successfully bootstrapped and tested on x86-64. commit 238ea13cca75ad499f227b60a95c40174c6caf78 Author: Vladimir N. Makarov Date: Wed Jan 27 14:53:28 2021 -0500 [PR97684] IRA: Recalculate pseudo classes if we added new pseduos since last calculation before updating equiv regs update_equiv_regs can use reg classes of pseudos and they are set up in register pressure sensitive scheduling and loop invariant motion and in live range shrinking. This info can become obsolete if we add new pseudos since the last set up. Recalculate it again if the new pseudos were added. gcc/ChangeLog: PR rtl-optimization/97684 * ira.c (ira): Call ira_set_pseudo_classes before update_equiv_regs when it is necessary. gcc/testsuite/ChangeLog: PR rtl-optimization/97684 * gcc.target/i386/pr97684.c: New. diff --git a/gcc/ira.c b/gcc/ira.c index f0bdbc8cf56..c32ecf814fd 100644 --- a/gcc/ira.c +++ b/gcc/ira.c @@ -5566,6 +5566,15 @@ ira (FILE *f) if (warn_clobbered) generate_setjmp_warnings (); + /* update_equiv_regs can use reg classes of pseudos and they are set up in + register pressure sensitive scheduling and loop invariant motion and in + live range shrinking. This info can become obsolete if we add new pseudos + since the last set up. Recalculate it again if the new pseudos were + added. */ + if (resize_reg_info () && (flag_sched_pressure || flag_live_range_shrinkage + || flag_ira_loop_pressure)) + ira_set_pseudo_classes (true, ira_dump_file); + init_alias_analysis (); loop_optimizer_init (AVOID_CFG_MODIFICATIONS); reg_equiv = XCNEWVEC (struct equivalence, max_reg_num ()); @@ -5610,9 +5619,6 @@ ira (FILE *f) regstat_recompute_for_max_regno (); } - if (resize_reg_info () && flag_ira_loop_pressure) - ira_set_pseudo_classes (true, ira_dump_file); - setup_reg_equiv (); grow_reg_equivs (); setup_reg_equiv_init (); diff --git a/gcc/testsuite/gcc.target/i386/pr97684.c b/gcc/testsuite/gcc.target/i386/pr97684.c new file mode 100644 index 00000000000..983bf535ad8 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr97684.c @@ -0,0 +1,24 @@ +/* PR rtl-optimization/97684 */ +/* { dg-do compile } */ +/* { dg-options "-O1 -flive-range-shrinkage -fschedule-insns -fselective-scheduling -funroll-all-loops -fno-web" } */ + +void +c5 (double); + +void +g4 (int *n4) +{ + double lp = 0.0; + int fn; + + for (fn = 0; fn < 18; ++fn) + { + int as; + + as = __builtin_abs (n4[fn]); + if (as > lp) + lp = as; + } + + c5 (lp); +}