From patchwork Mon Oct 3 06:08:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eugene Rozenfeld X-Patchwork-Id: 1639 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp812254wrs; Sun, 2 Oct 2022 23:09:24 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7jMXstIMzOsiPdmgAFqtAejIXBORu9CE7xPUi2+TE9lta9txzWLBRSCYkFcKNA9DOnwIjy X-Received: by 2002:a17:907:31c1:b0:742:28a3:5d08 with SMTP id xf1-20020a17090731c100b0074228a35d08mr13978163ejb.112.1664777364596; Sun, 02 Oct 2022 23:09:24 -0700 (PDT) Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id y17-20020a056402271100b0044e9be0186fsi7911159edd.546.2022.10.02.23.09.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Oct 2022 23:09:24 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=Ps3uURzH; arc=fail (signature failed); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8D48B3856DC4 for ; Mon, 3 Oct 2022 06:09:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8D48B3856DC4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1664777363; bh=PWgh35rCeD6jJupgqa+s/O/FxrmqO+9xQXtMD+GkqaA=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=Ps3uURzHbOook+xQGhlejwt3sPyMV1OJbKAd3KAK9r5rBf29JKaQ8KhXCQLWVPcoK VTjCB6cCxF8Bk0gLmLhgUKpHX0wQ/fI51ynP1pEFR2w43G8iufg5ZnezaSZG9XOOcI VseOi3IYGl/0ofhsM1OKcEaBc468+ScaY/scCcZw= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2130.outbound.protection.outlook.com [40.107.94.130]) by sourceware.org (Postfix) with ESMTPS id A14063858D38 for ; Mon, 3 Oct 2022 06:08:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A14063858D38 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DRzifY6YulkijVf2WkYdKepnztqrgwBNI7uPJAkFZ8yzyCXSf1OsJH7ytERJSnpcFmxDJUCi916QYZuOjXuJmtGaG3pacIi8VB6JHM/8UMlBSLM0XnaVmFGF/2520wMsE7SVyvVe580qOE6FPo1XKRrqTWpE7DCY8+qNr6/fE+ZY1oYQARQSCDwj8JrTlfgCP46cPHWwDnHcBRxT0Cxmzcju3yJrnwiUcad3BD18k8piy72b8YCi+CIugWZn3ETcswimDcq+1Ok9KDUkenPNMSdOoGM/O//Kxv2JtENpw0Ti8YUiLS9PWshHxuMw4o+HkYzvYS9DARGgYDc4wtxhDQ== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=PWgh35rCeD6jJupgqa+s/O/FxrmqO+9xQXtMD+GkqaA=; b=ZYu0/R4EB8CTMe5NL9BHACsWk9v1Poa0gW0rwqGKEpo9ixR58P9dPAz5B5y6IohYSGqHk4VYPWcpIrr38EEWfm2yAV+8goLCM/UxBcCT3MMcuXdDgazcLmete73/r/eaO489d3PPy3rvoz1RUulMrPW50tgaANglCS8xWdIZy5o2vGLEoaLBgKTJVVC3QZRPew3BzBZyhRGZxLdxje6XgpEME9fAnIh3UsVJsMNJh5UqDG/lWtpuebLnjd5MfXtPCckJrSLJqHwcjxyTcufh8i01BgEOnCzdnc7rD87cJNFxIb4Oudot7HwJsgLtVTuI/fda5X+OhgDWaSqiUINi2Q== 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 CY5PR21MB3542.namprd21.prod.outlook.com (2603:10b6:930:d::7) by SA0PR21MB1868.namprd21.prod.outlook.com (2603:10b6:806:e0::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5709.8; Mon, 3 Oct 2022 06:08:38 +0000 Received: from CY5PR21MB3542.namprd21.prod.outlook.com ([fe80::38ea:b9c1:41a7:b0ec]) by CY5PR21MB3542.namprd21.prod.outlook.com ([fe80::38ea:b9c1:41a7:b0ec%3]) with mapi id 15.20.5709.009; Mon, 3 Oct 2022 06:08:37 +0000 To: "gcc-patches@gcc.gnu.org" , Jason Merrill Subject: [PATCH] Set discriminators for call stmts on the same line within the same basic block Thread-Topic: [PATCH] Set discriminators for call stmts on the same line within the same basic block Thread-Index: AdjVMDrg0Z49eo6iQcWCpMO48rfU+A== Date: Mon, 3 Oct 2022 06:08:37 +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=a834cfcd-0aaa-45e1-a92d-8b32e96c887e; 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=2022-10-01T00:52:53Z; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SiteId=72f988bf-86f1-41af-91ab-2d7cd011db47; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: CY5PR21MB3542:EE_|SA0PR21MB1868:EE_ x-ms-office365-filtering-correlation-id: 89930b63-1d5e-4581-0c30-08daa505b633 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: eWQPx9+AOH2GqHXkRznbZk4ya5mN1qbSgQbo1BdI7l2XXllihCet65kVz+4Aetvt9djX8QcZFSSczy3oc0avoDtLrbN2gHENgiqCtNzmVVwkc86upYv2WeuAYjIntbmNeRRzsxz9WJvv80dFMv/kmY303LDdJ1WtKzbudrSP8UnfsJlhU6RUgqfMKYXssXi+ktehRWVk1CIf2MvEi8uMlMTv7vsKFrB6Y+6sP8IBuxTqf5AeUUCiGutIqZN/rK7auySYLHY5Zc3Hfjt7ZCbBNUqy5lj1sW46k+DBwYhpk90Bps+Tb44XXL/dCsZpq4TqJ8c418IwHRmLws8RGNn9NH4vCvFwaeapaVbERmxzXF+otEk9Y/kJ42l2R349tSkmAQvlwtwJTfHMVm2VK/b6jrRLv3ZVaRmIqD7W+3+yFvVAGXB2eKNtq87aIBsjjnJsyQY8pJe0zixh/CFLB+KC6OtQqNIWnw8dhaNAi7mKUu/GVPApW1q9U92YG1D9TOxI0zg3xYYYm38l/P1HkmBuN2hhl601XseM7IgZiQYdmKrHc8UHa8Nc+qQYJsjQRJhu5sxD7xDzHDXKozhdyv54BrSqSbZaXK7/IXfbfMF0vJinOtI+4+ksPOztMG9zW4+p8+hHTMiVVn1zwMY42YScWPqrxEJUpVSMlpFWaEhdMTVc1xAsnQ3o+VK28IQSKf1xj8GztolvxfM888+VwLoDNF6VltInipmEHB5x2T1u30PZ9Vq5RerD8kF3Nx+dn28NXo5A0uNScLR/oSiQp51TFK014CP6BtJibu8hq6Q9RDlBDKi3Odrv1TIPrIhKdkaQ x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY5PR21MB3542.namprd21.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(396003)(376002)(346002)(366004)(39860400002)(136003)(451199015)(316002)(122000001)(33656002)(10290500003)(478600001)(64756008)(8676002)(66946007)(66446008)(66476007)(66556008)(76116006)(41300700001)(82950400001)(82960400001)(38100700002)(38070700005)(7696005)(6506007)(83380400001)(186003)(55016003)(9686003)(71200400001)(86362001)(110136005)(8990500004)(52536014)(8936002)(5660300002)(2906002); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: SUPDI/Dq5oCEkAfk/TPvSECHr+b6Lgn7zJoFdB9g04XGywf0pVjZlUZRBvC8in2Ok2Eu+MqfjsPjPSwjmavZlWfOC/+nleivwPWutjpj+rmnvMzs1sZPrjNUCKOS3VYPINveyb0Gcj7XyN/Su2VMWryrM/fM9kmmreEntmLBuScuf0gbkuOI8DQGv1o0Zuh0ZpFM00gr4BpCp/2eJU61LzwipFClkUCb4/gHeCUc7q4v6OCTuobPg4uDz/WI4ngnnSoqzQkwfG7FmIgpcfVVSSOoMvfNhDQpieUGNNnQwVg3+zDG0eDJRSWWEu8K+8ToViHuPdAnRf7xCXJwyAo34zKFRiHSWsHhQlDdQHP+sip3AiI3v/dQdRH/8MxQav8yS73aSYl+s0dLpHbcT84YzMnp1ztkGZE9XmR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EhPZ3I+uWbcEUNV2H8ekxym99hvFZ4lUpvQexFXroPmHil7RjsfDDCr7QTDCrG4x4Ct8VSj5A4QVNvaaENl16A9S5QjnQ0u34RehVy71OMzqVAJAkzoh/fOjDycfCXQ7+zYtnta5/Yje5cfh/tq/Csg572ptNYHludVdG/O0 MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CY5PR21MB3542.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 89930b63-1d5e-4581-0c30-08daa505b633 X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Oct 2022 06:08:37.6095 (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: P0kP9wo9GNOpnGpR0DP2b5CnT+d/Qn6fhiFjLdRiZCAzXFigDAUV3G6zMn3okAb39igDVBrk+0Kfg3nCiq9Z1A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR21MB1868 X-Spam-Status: No, score=-9.8 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.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.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+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1745645590179592823?= X-GMAIL-MSGID: =?utf-8?q?1745645590179592823?= This change is based on commit 1e6c4a7a8fb8e20545bb9f9032d3854f3f794c18 by Dehao Chen in vendors/google/heads/gcc-4_8. Tested on x86_64-pc-linux-gnu. gcc/ChangeLog: * tree-cfg.cc (assign_discriminators): Set discriminators for call stmts on the same line within the same basic block. --- gcc/tree-cfg.cc | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) -- 2.25.1 diff --git a/gcc/tree-cfg.cc b/gcc/tree-cfg.cc index ade66c54499..8e2a3a5f6c6 100644 --- a/gcc/tree-cfg.cc +++ b/gcc/tree-cfg.cc @@ -1203,8 +1203,39 @@ assign_discriminators (void) { edge e; edge_iterator ei; + gimple_stmt_iterator gsi; gimple *last = last_stmt (bb); location_t locus = last ? gimple_location (last) : UNKNOWN_LOCATION; + location_t curr_locus = UNKNOWN_LOCATION; + int curr_discr = 0; + + /* Traverse the basic block, if two function calls within a basic block + are mapped to the same line, assign a new discriminator because a call + stmt could be a split point of a basic block. */ + for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) + { + gimple *stmt = gsi_stmt (gsi); + expanded_location curr_locus_e; + if (curr_locus == UNKNOWN_LOCATION) + { + curr_locus = gimple_location (stmt); + curr_locus_e = expand_location (curr_locus); + } + else if (!same_line_p (curr_locus, &curr_locus_e, gimple_location (stmt))) + { + curr_locus = gimple_location (stmt); + curr_locus_e = expand_location (curr_locus); + curr_discr = 0; + } + else if (curr_discr != 0) + { + gimple_set_location (stmt, location_with_discriminator ( + gimple_location (stmt), curr_discr)); + } + /* Allocate a new discriminator for CALL stmt. */ + if (gimple_code (stmt) == GIMPLE_CALL) + curr_discr = next_discriminator_for_locus (curr_locus); + } if (locus == UNKNOWN_LOCATION) continue;