From patchwork Thu Sep 28 16:07:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Vladimir Makarov X-Patchwork-Id: 1840923 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=iKyrH5bu; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.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 ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RxJLT1Z60z1yp8 for ; Fri, 29 Sep 2023 02:08:32 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 08B523864C6A for ; Thu, 28 Sep 2023 16:08:30 +0000 (GMT) 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 [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id B0DDC3855598 for ; Thu, 28 Sep 2023 16:08:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B0DDC3855598 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1695917297; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type; bh=y8NTkYndjpU/tmnhdeKhmvsmNGS1OMR3Vxw5zor/yXQ=; b=iKyrH5buMfOQYTmY9b4MZR55r7AlgerPAYSh/BFEqGpgF2sjUsfi6KBP8u1qllGjV9a5eN ec16rRjzAwkwYFAyaDfipawf0fl4WN3Il9dClhxPOlMZjpdisUenQC27zFjNQE6dMGbpm/ gyF6Vn/VvAjYlVeo0WCp19CDt5Bg+Ms= Received: from mail-qv1-f70.google.com (mail-qv1-f70.google.com [209.85.219.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-674-01ZwGRz5PMmCfGaqBjewIg-1; Thu, 28 Sep 2023 12:08:09 -0400 X-MC-Unique: 01ZwGRz5PMmCfGaqBjewIg-1 Received: by mail-qv1-f70.google.com with SMTP id 6a1803df08f44-65b0af1b0e2so152973736d6.0 for ; Thu, 28 Sep 2023 09:08:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695917289; x=1696522089; h=subject:from:to:content-language:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=48trnV1fCtFlASiovxupjfTwtgo0+YvG2FCu3fRw2HY=; b=pd5NznLfR6Vwj4QMHn5oQvnq0N6aK3gI8OR3On0BFNWrzYAB79dhBYkkupygQ46no2 GKKWv/4oTp5pNLY/qBmNdxUYVrRWB1KALai/UCzicCRXH3vOkcoL23dVt/CkoHqENCxa iwkGZUjN+aYbM7JR/T6o7c4xRPgkx7Twj2NZx2nJI1+yeTvUDLSzYhG0stjQimXwcjPp a4gHf2iUw86jMmONPNSE8/ihHVP8DRUkf3o2Z8bMjYlan2b99PfQgnQMR5ySsNb+UWU/ 0htBbpCwuqJXY6FIIFMab0NCwYlfjQrRfKuyXPSd481ehSWd9brW6df1rGzVPEQJuL7a /6hQ== X-Gm-Message-State: AOJu0YzhZEbA+pbgGc0DkBdpTYQuVmWT0oudWA88t4ZcF4QVAnyk85dS MZgJAeZjs8q7q4wkDFl6r7DCdzLrMMsJ0naSl3+XtIv0kqn0F1kr4cIOlOsbB/ynq0fztqZ6GmP B6dVl1kr9gtS/0xKrDKlxWYTqWmu+oot9eHIWUNOFJytBWA8agRyTTYYHnwKUyF5yzovKU4Xj6c Skag== X-Received: by 2002:a0c:dd87:0:b0:658:a043:376b with SMTP id v7-20020a0cdd87000000b00658a043376bmr1566355qvk.8.1695917288821; Thu, 28 Sep 2023 09:08:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFaBAChf6VHFnM67QUcShr/m9/67qC/NcUz9tMRvcc9KCDCBRRkZDJGOx/nEt/TIPM0lBEHpg== X-Received: by 2002:a0c:dd87:0:b0:658:a043:376b with SMTP id v7-20020a0cdd87000000b00658a043376bmr1566327qvk.8.1695917288421; Thu, 28 Sep 2023 09:08:08 -0700 (PDT) Received: from [192.168.1.88] (23-233-12-249.cpe.pppoe.ca. [23.233.12.249]) by smtp.gmail.com with ESMTPSA id b2-20020a0cb3c2000000b0065b08bb01b1sm3807845qvf.60.2023.09.28.09.07.55 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 28 Sep 2023 09:08:08 -0700 (PDT) Message-ID: <0d100372-c502-accc-d1cd-7763b6790c4a@redhat.com> Date: Thu, 28 Sep 2023 12:07:54 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 To: "gcc-patches@gcc.gnu.org" From: Vladimir Makarov Subject: reverting patch to improve equiv cost calculation X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org I've got a lot of complaints about my recent patch to improve equiv cost calculation.  So I am reverting the patch. commit 8552dcd8e4448c02fe230662093756b75dd94399 Author: Vladimir N. Makarov Date: Thu Sep 28 11:53:51 2023 -0400 Revert "[RA]: Improve cost calculation of pseudos with equivalences" This reverts commit 3c834d85f2ec42c60995c2b678196a06cb744959. Although the patch improves x86-64 specfp2007, it also results in performance and code size regression on different targets and new GCC testsuite failures on tests expecting a specific output. diff --git a/gcc/ira-costs.cc b/gcc/ira-costs.cc index 8c93ace5094..d9e700e8947 100644 --- a/gcc/ira-costs.cc +++ b/gcc/ira-costs.cc @@ -1947,8 +1947,15 @@ find_costs_and_classes (FILE *dump_file) } if (i >= first_moveable_pseudo && i < last_moveable_pseudo) i_mem_cost = 0; - else - i_mem_cost -= equiv_savings; + else if (equiv_savings < 0) + i_mem_cost = -equiv_savings; + else if (equiv_savings > 0) + { + i_mem_cost = 0; + for (k = cost_classes_ptr->num - 1; k >= 0; k--) + i_costs[k] += equiv_savings; + } + best_cost = (1 << (HOST_BITS_PER_INT - 2)) - 1; best = ALL_REGS; alt_class = NO_REGS;