From patchwork Fri Sep 6 08:11:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Krebbel X-Patchwork-Id: 1158861 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-508447-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="hc+vRRzV"; 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 46Pqyj4Y9pz9s3Z for ; Fri, 6 Sep 2019 18:11:39 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:date:mime-version:content-type :content-transfer-encoding:message-id; q=dns; s=default; b=EStLq 8CJK9JQhGJSZ1kMnG78uXqM1ChVIWd7+BGJg9wQ5zEWo6RtL1EVCwZdj19ou7thQ EyhB4vV548Fn/a0VoKGeNmPITWCjMhSCyIfUmMll7AqXBc8By4abguGEBPdixmXN nm5QF6HYeiyqY0h8pFEd3V1MG5gfPS1gDqe1dk= 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:to :from:subject:date:mime-version:content-type :content-transfer-encoding:message-id; s=default; bh=2P8iIatPZSX rs6R678t05ZypvBw=; b=hc+vRRzVKRU1k6G9AE3M7M+6Exdmd7RDZPZriebMtlS Jyn53zar7GmXCbuLS0A//i2uO5P3pxJ8aDeBcrQW69V8tlrPeWN8aJHdn7zGOODC fr3fKfeVdMHyWWK6HpGjiIjF+FduCNFxu+Rwgy2xZY301sPJBHM7bS7c8DDc++WU = Received: (qmail 34042 invoked by alias); 6 Sep 2019 08:11:32 -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 33854 invoked by uid 89); 6 Sep 2019 08:11:32 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-15.3 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.1 spammy=ssh, 2019-06-06, 20190606 X-HELO: mx0a-001b2d01.pphosted.com Received: from mx0b-001b2d01.pphosted.com (HELO mx0a-001b2d01.pphosted.com) (148.163.158.5) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 06 Sep 2019 08:11:30 +0000 Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x8687vqD017217 for ; Fri, 6 Sep 2019 04:11:28 -0400 Received: from e06smtp03.uk.ibm.com (e06smtp03.uk.ibm.com [195.75.94.99]) by mx0a-001b2d01.pphosted.com with ESMTP id 2uuj62b7gw-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 06 Sep 2019 04:11:28 -0400 Received: from localhost by e06smtp03.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 6 Sep 2019 09:11:26 +0100 Received: from b06avi18626390.portsmouth.uk.ibm.com (9.149.26.192) by e06smtp03.uk.ibm.com (192.168.101.133) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Fri, 6 Sep 2019 09:11:25 +0100 Received: from b06wcsmtp001.portsmouth.uk.ibm.com (b06wcsmtp001.portsmouth.uk.ibm.com [9.149.105.160]) by b06avi18626390.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x868B0fe36372812 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 6 Sep 2019 08:11:00 GMT Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5D8E0A405F for ; Fri, 6 Sep 2019 08:11:24 +0000 (GMT) Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3D6D4A405C for ; Fri, 6 Sep 2019 08:11:24 +0000 (GMT) Received: from [9.152.222.93] (unknown [9.152.222.93]) by b06wcsmtp001.portsmouth.uk.ibm.com (Postfix) with ESMTP for ; Fri, 6 Sep 2019 08:11:24 +0000 (GMT) To: gcc-patches@gcc.gnu.org From: Andreas Krebbel Subject: PR88751: Backport to GCC 8 and 9 branches? Date: Fri, 6 Sep 2019 10:11:24 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 x-cbid: 19090608-0012-0000-0000-0000034764C6 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19090608-0013-0000-0000-00002181BDE9 Message-Id: X-IsSubscribed: yes Hi, since this caused a critical performance regression in the OpenJ9 byte code interpreter after migrating from GCC 4.8 to GCC 7 I would like to backport this patch also to GCC 8 and 9 branch. Ok - after bootstrap and regression test went fine? Andreas commit d3dc20418aad41af83fe45ccba527deb0b334983 Author: krebbel Date: Thu Jun 6 11:35:04 2019 +0000 Fix PR88751 This patch implements a small improvement for the heuristic in lra which decides when it has to activate the simpler register allocation algorithm. gcc/ChangeLog: 2019-06-06 Andreas Krebbel PR rtl-optimization/88751 * ira.c (ira): Use the number of the actually referenced registers when calculating the threshold. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@271996 138bc75d-0d04-0410-961f-82ee72b054a4 diff --git a/gcc/ira.c b/gcc/ira.c index 4a14fb31583..725636d8dc5 100644 --- a/gcc/ira.c +++ b/gcc/ira.c @@ -5198,6 +5198,8 @@ ira (FILE *f) int ira_max_point_before_emit; bool saved_flag_caller_saves = flag_caller_saves; enum ira_region saved_flag_ira_region = flag_ira_region; + unsigned int i; + int num_used_regs = 0; clear_bb_flags (); @@ -5213,12 +5215,17 @@ ira (FILE *f) ira_conflicts_p = optimize > 0; + /* Determine the number of pseudos actually requiring coloring. */ + for (i = FIRST_PSEUDO_REGISTER; i < DF_REG_SIZE (df); i++) + num_used_regs += !!(DF_REG_USE_COUNT (i) + DF_REG_DEF_COUNT (i)); + /* If there are too many pseudos and/or basic blocks (e.g. 10K pseudos and 10K blocks or 100K pseudos and 1K blocks), we will use simplified and faster algorithms in LRA. */ lra_simple_p = (ira_use_lra_p - && max_reg_num () >= (1 << 26) / last_basic_block_for_fn (cfun)); + && num_used_regs >= (1 << 26) / last_basic_block_for_fn (cfun)); + if (lra_simple_p) { /* It permits to skip live range splitting in LRA. */