From patchwork Fri Jul 30 07:08:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eugene Rozenfeld X-Patchwork-Id: 1511526 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=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@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=CI9beXek; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (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 4GbdnK3G99z9sRN for ; Fri, 30 Jul 2021 17:09:41 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2D1E0389443B for ; Fri, 30 Jul 2021 07:09:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2D1E0389443B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1627628979; bh=pD1oAj5yGjGwiixB6RMenqDfsHz2ZGeZfoewTQxga+Y=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=CI9beXekEArIOfCsEaP/MAsLueil4lTqjwoHi3WFZy4C6ET0puUB9OW0jrxlgP9DF E2dEKaJsfAQEXBSP3PmNXERXH2pmTO42l0aGHG5qk2Q8uvlvXCSP4lyBU6fEwbGWpw E51eMH/M0Td5IS9aKWNZKUdr/XLt2G5a0a7m/Rkk= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2095.outbound.protection.outlook.com [40.107.93.95]) by sourceware.org (Postfix) with ESMTPS id 64DB3389443F for ; Fri, 30 Jul 2021 07:08:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 64DB3389443F ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=coS7Cqt7nInsSeyj50vy0WROzzq0wuS5KGSZd4f3CXrKJ8DkEzQz3krCPR8j3F0RKp2wD2RoCHlVCKyrOIAI1K6CU0uwB9+xwj6D/XDXij5GleSdZhOflmWSwwkmnBNWy6ZffYKnky+02Y9mK/3AMkeM8IzuSXPkd/nu8rxBocrbnlTMYlf32TUED/cr0pM7VNRBsolKhVlvEbxhEdgx4ZO2/nqwwQaTasLKsxS4EsTiVqrr6bQxtzISxgvPCOQjYmz2Z6XsDFbizpmCvaYTWHOPuWCsCuA6kH68GexJyUiAvscvWulE2/MsARdq0EbNx2DZ1PgAQ6KMddOg/lYrXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=pD1oAj5yGjGwiixB6RMenqDfsHz2ZGeZfoewTQxga+Y=; b=A/IxtbnWSMwJqI4mtAqMl5q6FACyB6fyTnNtMAmbV/WOoycPPFJrMKoHOj/FHixKu43T3BjGsD0A45TuzoksrBlsu6jq3IFxMEhEoKCSMMy4Qc5wSyml71qlppDXJ0NfzWCaDVPqIWuUyVpBc6DB672KZ+LMsjbEOSLWveELE+MLIC59J6PnRlxeQVY2/a6CSXGssjR/o3lC0L9giVdzFrAiAiYwMiRZDGbR/8jo0vHVkHusCjIBY+gFb2VGZpAfR9hbQvVyJVwTqe2q11Y9ojBBsi8hZvPmZ39lNJpCmyQ4X0EazSu3ktDZjHyrVPx8EBQlESsoBS53SqiWEryAqg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microsoft.com; dmarc=pass action=none header.from=microsoft.com; dkim=pass header.d=microsoft.com; arc=none Received: from MWHPR21MB0798.namprd21.prod.outlook.com (2603:10b6:300:128::18) by MW4PR21MB1907.namprd21.prod.outlook.com (2603:10b6:303:71::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4394.3; Fri, 30 Jul 2021 07:08:42 +0000 Received: from MWHPR21MB0798.namprd21.prod.outlook.com ([fe80::a8d6:e48b:4436:4617]) by MWHPR21MB0798.namprd21.prod.outlook.com ([fe80::a8d6:e48b:4436:4617%14]) with mapi id 15.20.4394.011; Fri, 30 Jul 2021 07:08:42 +0000 To: "gcc-patches@gcc.gnu.org" , "mliska@suse.cz" , Andi Kleen Subject: [PATCH] gcov-profile/71672 Fix indirect call inlining with AutoFDO Thread-Topic: [PATCH] gcov-profile/71672 Fix indirect call inlining with AutoFDO Thread-Index: AdeFEPmkcWxcHhqOSSeWHCrnjDIl9g== Date: Fri, 30 Jul 2021 07:08:42 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_ActionId=395093d0-80a6-41f8-a505-0b3f8bd1270e; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_ContentBits=0; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Enabled=true; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Method=Standard; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Name=Internal; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SetDate=2021-07-30T07:01:22Z; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SiteId=72f988bf-86f1-41af-91ab-2d7cd011db47; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: b7b12bb7-4f9c-4b2f-fc7b-08d95328dd24 x-ms-traffictypediagnostic: MW4PR21MB1907: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8882; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: zAPUx5W7SfjmydWzevxeTa38Eq9YYLVs5pL9xR7pLvDhpcjT3dJxju5Hoo/DHzJtQPNMZEco2/BwsM8BW3WgAj30zpIIVe96qIhmo2ubxLflJwMjtlXg3z6HpHMLTgTZFc8/W2uyh01eYd8p+PmhP/erQvUZxFVzXuZd9yD2t2nQ0bx+oIeMtVZ7/cDGnfXwonimMMcbDaziWSgD+qEu4hU3funmB+pGvpJAFv8eYG+Q78SuF02uc6Q9TajuZRMRkFZxpdYcoYSlVHx9z8jkW73c/AP4S6AnQCdED47ocz2ze9V9Nc6+udvjf1ebKRVVQlRHAdzOODT/YTgv7buNZp28p8r6c9bSArlfPftf7Z9pqhdXhamP8tYTQUAdHQO2WI46g71UCgMzfVMuyBAlJg7v86HBWvUBpMaQTl8XF3xOwpmFT6lLtNlZeMVrxbF06xEQN3uUfG/igqn7yK2a/spvCprsXMkpWzAsgsC0fGNXvluRLCbifl/UYguZS09vsoausVfE6ZYX73N5GI4Wh/ulVP6xDVye0yyOaE5fBelWtu0f1ixVKFB4IOjGOPiUxzyLzpMOpUmraH2S1mZ1MrRBSu2Ppw0nFdLacTAUi9NhOTVpg2TmndfRkC+di2niUSkSxyNTML+Oq1ZoScli0Lm0eGZCVlBxlJ5oIjB115m5fTLmoOnGdgReZT00qouC50xWsft5heVawEoxdvEl4PzAhv2JYzroDVB2B5csoCHdQBLMr19zuDKBkg6xctnCHlQjduGD+W04O6VHbLwovG7fGfT9tduHstUwAxQvIX0= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR21MB0798.namprd21.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(5660300002)(110136005)(2906002)(52536014)(8990500004)(66446008)(83380400001)(8936002)(122000001)(8676002)(38100700002)(6506007)(9686003)(7696005)(33656002)(186003)(316002)(55016002)(508600001)(38070700005)(966005)(64756008)(66476007)(10290500003)(82950400001)(76116006)(86362001)(66946007)(71200400001)(66556008)(82960400001); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: 8lKf7fhvZ12E6Rq8iu6ZPckVmZ6NB3UMoAc3cSYlmRCEP1MJmbsIVotv8TAaYXOHEyNMAHFyAByFuVtZ9HCBlBrDZI3QrZz8q8WZuAHXp12UfnIt/gcNBON4yY++u9uYASjpfgPk0fBpoqXZ2FbYL1JAKXyoKNTJ+oByQP+lwyg+ZNeM+FVg/4x530i0oRrDy7KbPiUY/Nd1nodIgZ/1WMwx6V0a1UvrT7kuzsw5/62W7Q8L3kDnjaa9T/TxW/Y7wVw1cDwI3BwZ86U48ZzzEqMU8smTsDwXncShPRVEOeWVZiil0kN4ZxVjNWGZRYGm7oju+6uwkvnuL1HL3Dg+bEtyEDkNU/1TVuJn/yGvBEmq+yWrIxtcBAwiAsR4R9c0YaiOk+yjKAMlZa3Kqvypg6zxi9g3Z90jbNoLXQ8ZkN1gwb4ZEh4UB+K/RTaW8BfjaDxrXHYPyOGEu1gZeSf5pl23sJIGVFvDl/KPHgCqg9yJcqP3faFmJwX74P0gipjKb8hhPf5PgE/n3eYdfny0fxJOBNx1Jfs7mfJVEH8V+3v+AYe9xFhhJXtfhPKj9Jahyh1R2z0Wo/zTRAVwc2vP19MmHx2ipTT2rdlADFiyurRkSFe0aCkj9mGfTYx7NncxqRXQd5Ir0yCpXOz7AUieGVeqf7/Y5NSs4aIU2dU1FBrafA/RpxyisK/+zLNoNfUy/F19fP7LHRYaBURIQnWuac66DHjSW6BxZ2GXbsMnBeT6+FR3QXIMcnFpmjh99oAzmPGe+3yv5RlkHKI05Tuaf/gsY35k71tnGN14J9sFV388EL0PCTHqdNKoKMjanvjK5OaaztM/DBY6tsFQeeB+4C0AZpEVtioYOnsbYfbtKGuuCLa2LA0ocusCwhlyVxz34H2+NvNvzO1LMcXlr42co9ejtrbamPerzWQSzNNmsJbyAqwkTwEGsN6BnuSpEFwrLa9NmCbJDV+LU63GdiWBrFt4J7wXOXGkyyQuR1UNcrOhfIi8+UDzU7tUv2jAQRgqYPE8rEXry40Xvm/o5/V1y3E98sBO93VhCy/BlwbaWTWhEZqc+GV2LIQ0Dll1AOYwWbWqZj4S0ltEMZNZCxZ5Owl11DVkAWyHPhtObkW0vz1M+googZIaF4Wr1+AHgX5nnNUzwuHczsY1wzVXiltxm4dArNjdlqfTqAKDuwNec9MGlLYTcM9Alcj66BRXGJddUFxi3lIkiARy2NTljworMGIVd7o9yaNN2VhVEHKWZlP9M6VzC6C1gI2vYfdFNifuMWud7Hd0u7AA7W1sbwJjjj778P9PiwO/7vKiHdy86Wj4s2LBhMHW6Talr4r61WW7nSQNpiwKqqriNbBTAyL1ttfYHKpOG+WYFOqh0mUTCBOXY6olaR38+hk/tXMftJFd x-ms-exchange-transport-forked: True MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MWHPR21MB0798.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: b7b12bb7-4f9c-4b2f-fc7b-08d95328dd24 X-MS-Exchange-CrossTenant-originalarrivaltime: 30 Jul 2021 07:08:42.2332 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 5lm2IhsP98iH3fxYnICjwZefaLi9rkRJHWBk5c5qEjekVXZCqAFxeFfYVh/Z7XiMz7SBQltfpKEKdb2bZEX+Fw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR21MB1907 X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FORGED_SPF_HELO, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: Eugene Rozenfeld via Gcc-patches From: Eugene Rozenfeld Reply-To: Eugene Rozenfeld Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" This patch has the following changes: 1. The main fix is in auto-profile.c: the histogram value for indirect calls was incorrectly set up. That is fixed now. 2. Several tests now have -fdump-ipa-afdo-optimized instead of -fdump-ipa-afdo in dg-options so that the expected output can be found. 3. I increased the number of iterations in several tests so that perf can have enough sampling events. 4. indir-call-prof-2.c has -fno-early-inlining but AutoFDO can't work without early inlining (it needs to match the inlining of the profiled binary). I changed profopt.exp to always pass -fearly-inlining for AutoFDO. With that the indirect call inlining in indir-call-prof-2.c happens in the early inliner so I changed the dg-final-use-autofdo. 5. create_gcov tool doesn't currently support dwarf 5 so I made a change in profopt.exp to pass -gdwarf-4 when compiling the binary to profile. 6. I updated the invocation of create_gcov in profopt.exp to pass -gcov_version=2. I recently made a change to create_gcov to support version 2: https://github.com/google/autofdo/pull/117 7. I removed useless -o perf.data from the invocation of gcc-auto-profile in target-supports.exp. With these changes the tests checking indirect call inlining in gcc.dg and g++.dg are passing. gcc/ChangeLog: PR gcov-profile/71672 * auto-profile.c (afdo_indirect_call): Fix the setup of the historgram value for indirect calls. gcc/testsuite/ChangeLog: PR gcov-profile/71672 * g++.dg/tree-prof/indir-call-prof.C: Fix options, increase the number of iterations. * g++.dg/tree-prof/morefunc.C: Fix options, increase the number of iterations. * g++.dg/tree-prof/reorder.C: Fix options, increase the number of iterations. * gcc.dg/tree-prof/indir-call-prof-2.c: Fix options, fix dg-final-use-autofdo, increase the number of iterations. * gcc.dg/tree-prof/indir-call-prof.c: Fix options. * lib/profopt.exp: Pass gdwarf-4 when compiling binary to profile; pass -fearly-inlining when compiling with AutoFDO; pass -gcov_version=2 to create_gcov. * lib/target-supports.exp: Remove unnecessary -o perf.data passed to gcc-auto-profile. --- gcc/auto-profile.c | 13 +++++++++---- gcc/testsuite/g++.dg/tree-prof/indir-call-prof.C | 4 ++-- gcc/testsuite/g++.dg/tree-prof/morefunc.C | 7 ++++--- gcc/testsuite/g++.dg/tree-prof/reorder.C | 6 +++--- gcc/testsuite/gcc.dg/tree-prof/indir-call-prof-2.c | 8 ++++---- gcc/testsuite/gcc.dg/tree-prof/indir-call-prof.c | 2 +- gcc/testsuite/lib/profopt.exp | 6 +++--- gcc/testsuite/lib/target-supports.exp | 2 +- 8 files changed, 27 insertions(+), 21 deletions(-) -- 2.25.1 diff --git a/gcc/auto-profile.c b/gcc/auto-profile.c index b23b82b2df4..4c1fc6b536b 100644 --- a/gcc/auto-profile.c +++ b/gcc/auto-profile.c @@ -1009,13 +1009,18 @@ afdo_indirect_call (gimple_stmt_iterator *gsi, const icall_target_map &map, histogram_value hist = gimple_alloc_histogram_value ( cfun, HIST_TYPE_INDIR_CALL, stmt, callee); - hist->n_counters = 3; + hist->n_counters = 4; hist->hvalue.counters = XNEWVEC (gcov_type, hist->n_counters); gimple_add_histogram_value (cfun, stmt, hist); - hist->hvalue.counters[0] = direct_call->profile_id; - hist->hvalue.counters[1] = max_iter->second; - hist->hvalue.counters[2] = total; + // Total counter + hist->hvalue.counters[0] = total; + // Number of value/counter pairs + hist->hvalue.counters[1] = 1; + // Value + hist->hvalue.counters[2] = direct_call->profile_id; + // Counter + hist->hvalue.counters[3] = max_iter->second; if (!transform) return; diff --git a/gcc/testsuite/g++.dg/tree-prof/indir-call-prof.C b/gcc/testsuite/g++.dg/tree-prof/indir-call-prof.C index 3374744613e..b45417106d0 100644 --- a/gcc/testsuite/g++.dg/tree-prof/indir-call-prof.C +++ b/gcc/testsuite/g++.dg/tree-prof/indir-call-prof.C @@ -1,4 +1,4 @@ -/* { dg-options "-O2 -fdump-tree-optimized -fdump-ipa-profile-optimized -fdump-ipa-afdo" } */ +/* { dg-options "-O2 -fdump-tree-optimized -fdump-ipa-profile-optimized -fdump-ipa-afdo-optimized" } */ struct A { A () {} @@ -26,7 +26,7 @@ main (void) int i; - for (i = 0; i < 1000000; i++) + for (i = 0; i < 10000000; i++) { p = (A *)wrap ((void *)&a); p->AA (); diff --git a/gcc/testsuite/g++.dg/tree-prof/morefunc.C b/gcc/testsuite/g++.dg/tree-prof/morefunc.C index 621d09aec5b..96e0073ca8f 100644 --- a/gcc/testsuite/g++.dg/tree-prof/morefunc.C +++ b/gcc/testsuite/g++.dg/tree-prof/morefunc.C @@ -1,4 +1,5 @@ -/* { dg-options "-O2 -fno-devirtualize --param=profile-func-internal-id=0 -fdump-ipa-profile-optimized -fdump-ipa-afdo -Wno-attributes -Wno-coverage-mismatch -Wno-missing-profile" } */ +/* { dg-options "-O2 -fno-devirtualize --param=profile-func-internal-id=0 -fdump-ipa-profile-optimized -fdump-ipa-afdo-optimized -Wno-attributes -Wno-coverage-mismatch -Wno-missing-profile" } */ + #include "reorder_class1.h" #include "reorder_class2.h" @@ -19,7 +20,7 @@ static __attribute__((always_inline)) void test1 (A *tc) { int i; - for (i = 0; i < 1000; i++) + for (i = 0; i < 10000000; i++) g += tc->foo(); if (g<100) g++; } @@ -28,7 +29,7 @@ static __attribute__((always_inline)) void test2 (B *tc) { int i; - for (i = 0; i < 1000000; i++) + for (i = 0; i < 10000000; i++) g += tc->foo(); } diff --git a/gcc/testsuite/g++.dg/tree-prof/reorder.C b/gcc/testsuite/g++.dg/tree-prof/reorder.C index 000fb651a69..50490963369 100644 --- a/gcc/testsuite/g++.dg/tree-prof/reorder.C +++ b/gcc/testsuite/g++.dg/tree-prof/reorder.C @@ -1,4 +1,4 @@ -/* { dg-options "-O2 -fno-devirtualize --param=profile-func-internal-id=0 -fdump-ipa-profile-optimized -fdump-ipa-afdo -Wno-coverage-mismatch -Wno-attributes" } */ +/* { dg-options "-O2 -fno-devirtualize --param=profile-func-internal-id=0 -fdump-ipa-profile-optimized -fdump-ipa-afdo-optimized -Wno-coverage-mismatch -Wno-attributes" } */ #ifdef _PROFILE_USE #include "reorder_class1.h" @@ -13,7 +13,7 @@ static __attribute__((always_inline)) void test1 (A *tc) { int i; - for (i = 0; i < 1000000; i++) + for (i = 0; i < 10000000; i++) g += tc->foo(); if (g<100) g++; } @@ -22,7 +22,7 @@ static __attribute__((always_inline)) void test2 (B *tc) { int i; - for (i = 0; i < 1000000; i++) + for (i = 0; i < 10000000; i++) g += tc->foo(); } diff --git a/gcc/testsuite/gcc.dg/tree-prof/indir-call-prof-2.c b/gcc/testsuite/gcc.dg/tree-prof/indir-call-prof-2.c index bbba0521018..594c3f34d57 100644 --- a/gcc/testsuite/gcc.dg/tree-prof/indir-call-prof-2.c +++ b/gcc/testsuite/gcc.dg/tree-prof/indir-call-prof-2.c @@ -1,4 +1,4 @@ -/* { dg-options "-O2 -fno-early-inlining -fdump-ipa-profile-optimized -fdump-ipa-afdo" } */ +/* { dg-options "-O2 -fno-early-inlining -fdump-ipa-profile-optimized -fdump-tree-einline-optimized" } */ volatile int one; static int add1 (int val) @@ -22,7 +22,7 @@ int main (void) { int i, val = 0; - for (i = 0; i < 100000; i++) + for (i = 0; i < 10000000; i++) { val = do_op (val, add1); val = do_op (val, sub1); @@ -31,5 +31,5 @@ main (void) } /* { dg-final-use-not-autofdo { scan-ipa-dump "Indirect call -> direct call.* add1 .will resolve by ipa-profile" "profile"} } */ /* { dg-final-use-not-autofdo { scan-ipa-dump "Indirect call -> direct call.* sub1 .will resolve by ipa-profile" "profile"} } */ -/* { dg-final-use-autofdo { scan-ipa-dump "Indirect call -> direct call.* add1 .will resolve by ipa-profile" "afdo"} } */ -/* { dg-final-use-autofdo { scan-ipa-dump "Indirect call -> direct call.* sub1 .will resolve by ipa-profile" "afdo"} } */ +/* { dg-final-use-autofdo { scan-tree-dump "Inlining add1/1 into main/4." "einline"} } */ +/* { dg-final-use-autofdo { scan-tree-dump "Inlining sub1/2 into main/4." "einline"} } */ diff --git a/gcc/testsuite/gcc.dg/tree-prof/indir-call-prof.c b/gcc/testsuite/gcc.dg/tree-prof/indir-call-prof.c index 138b85a08d2..702045239f3 100644 --- a/gcc/testsuite/gcc.dg/tree-prof/indir-call-prof.c +++ b/gcc/testsuite/gcc.dg/tree-prof/indir-call-prof.c @@ -1,4 +1,4 @@ -/* { dg-options "-O2 -fdump-tree-optimized -fdump-ipa-profile-optimized -fdump-ipa-afdo" } */ +/* { dg-options "-O2 -fdump-tree-optimized -fdump-ipa-profile-optimized -fdump-ipa-afdo-optimized" } */ static int a1 (void) { diff --git a/gcc/testsuite/lib/profopt.exp b/gcc/testsuite/lib/profopt.exp index 9997eb3bb7e..25f45ecf2de 100644 --- a/gcc/testsuite/lib/profopt.exp +++ b/gcc/testsuite/lib/profopt.exp @@ -289,8 +289,8 @@ proc auto-profopt-execute { src } { return } set profile_wrapper [profopt-perf-wrapper] - set profile_option "-g -DFOR_AUTOFDO_TESTING" - set feedback_option "-fauto-profile -DFOR_AUTOFDO_TESTING" + set profile_option "-gdwarf-4 -DFOR_AUTOFDO_TESTING" + set feedback_option "-fauto-profile -DFOR_AUTOFDO_TESTING -fearly-inlining" set run_autofdo 1 profopt-execute $src unset profile_wrapper @@ -451,7 +451,7 @@ proc profopt-execute { src } { # convert profile if { $run_autofdo == 1 } { set bprefix "afdo." - set cmd "create_gcov --binary $execname1 --profile=$tmpdir/$base.perf.data -gcov_version=1 --gcov=$tmpdir/$bprefix$base.$ext" + set cmd "create_gcov --binary $execname1 --profile=$tmpdir/$base.perf.data -gcov_version=2 --gcov=$tmpdir/$bprefix$base.$ext" verbose "Running $cmd" set id [remote_spawn "" $cmd] if { $id < 0 } { diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index 789723fb287..ae22e103883 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -626,7 +626,7 @@ proc check_effective_target_keeps_null_pointer_checks { } { # this allows parallelism of 16 and higher of parallel gcc-auto-profile proc profopt-perf-wrapper { } { global srcdir - return "$srcdir/../config/i386/gcc-auto-profile -o perf.data -m8 " + return "$srcdir/../config/i386/gcc-auto-profile -m8 " } # Return true if profiling is supported on the target.