From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02on2088.outbound.protection.outlook.com [40.107.247.88]) by sourceware.org (Postfix) with ESMTPS id 474FA3858D37 for ; Wed, 22 Nov 2023 14:44:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 474FA3858D37 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 474FA3858D37 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=40.107.247.88 ARC-Seal: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1700664269; cv=pass; b=ZUiLzxQObXsMiF1ShrLC0NU6Lu9Vx3XZLeCioS+chhACN2lNVge/m6tQX0RpE56aeu6Sj+aigqMsDNTs4D3t2Zkj1pk/GnrPi8NAxNlsXfcNu0ElzE6sd3VEcMCC0ophG3Vdcb6CgbrnW8P7NmbuCoH1r7XFkPuW+xvZ2QuNRr4= ARC-Message-Signature: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1700664269; c=relaxed/simple; bh=mgzZ11gsLSci3tixYIE3vEyubkEeP+sHBmf5H1pGugg=; h=DKIM-Signature:DKIM-Signature:Date:From:To:Subject:Message-ID: MIME-Version; b=Ok94jiwk6WjGpbV1CpWFsTSmt61+uv9jsX9F5Xaq0xROURVrfyZHlYZpIdiFWLkQ6Ql8B1n5pHWP5hZBCsj4hIzDMHy0C0dXGvo+GVOApySrvKKb8yS+Xe0O++1HwK/IispBTTEKGiUZxkRoNPszed03Wk6UrtkZBKSzkuivz3k= ARC-Authentication-Results: i=3; server2.sourceware.org ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=H7Fo65qFIekZBEJfO8W6gZ0pCW2uicRPU0CpOXq2I6ccDze1yAuTAUOfvwkLL9nh32nGWkIJ5KSVfXt6Qq6obWT7e65qVegxU1mfeoSo6khRkvvpbhPS+qljmPM312zXrsFcl160yg2qsiL4dSjMfZa2++VY4ds5cCx11rjUu6YwGJTYOy+Lp2/S7ta1uyqQj0V2NcHXJPMPLQnwwTYLT+eIcnWpvrkdCSQyvrpS2k9s4xN1l+aiqNK/KRxPAky1IZG80IwKF8udr1+7c8ETZx/ipcALvnE2BcsWPVexefEP8BEO+PY5CowGW12XHS/Fn3F0kCg0Aiy6dQwwDr+Pvw== ARC-Message-Signature: i=2; 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=gum0x3g4ipAhlrmqCngYMXgl9b92HocOIXMZYA13YbY=; b=d9IIOYilCZpplH/hin21nnZBfxFN51t9bKfY9b+1I8j1+OuKFjFafFns0CKrz3PDModpP69khPmHg+384EhDKv+58N/etnIXrNRZ40VsS4YCnYgK1QkeOY/gnONFGtzq/pxgIPzPiDqYDf4jifV2jHIgZ7Jw8zSfCYpolBKL9Ng6qfhwLZLFmKwOBKJqqpNmUPVYMjVrodM+l4rsB/WgOr4YvsPXfOl1/ZRqoi+LYlK7WBH7HmusSv7/bE2hL4ob1RxP1L2jLFlZ79N0qaw1H7vUu3nM/EngO5CuoX4Qc0OHJrNLXt+yiGSz4wPK9DUQadoeV4HoznSIce+StMDF0w== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=gcc.gnu.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com]) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=gum0x3g4ipAhlrmqCngYMXgl9b92HocOIXMZYA13YbY=; b=JCBxdgriV2CDBb7bw3fg/b0KgWUpCj4mbeFdQfqB+xnI2emYNud4tO7YzbGmIkCAAFqcp36s8QBQl0Ijxm9fXECwiQOG8YxsmGlG4em8fp2zRDdwwZchN/7BZNvc0HiFZBS+8jeXg++5x2Czzm26cMPDjD1IuY0F56qHySkrkFI= Received: from AM6P192CA0063.EURP192.PROD.OUTLOOK.COM (2603:10a6:209:82::40) by GVXPR08MB10763.eurprd08.prod.outlook.com (2603:10a6:150:15c::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7002.28; Wed, 22 Nov 2023 14:44:21 +0000 Received: from AMS0EPF000001A9.eurprd05.prod.outlook.com (2603:10a6:209:82:cafe::f1) by AM6P192CA0063.outlook.office365.com (2603:10a6:209:82::40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7025.18 via Frontend Transport; Wed, 22 Nov 2023 14:44:21 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; pr=C Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AMS0EPF000001A9.mail.protection.outlook.com (10.167.16.149) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7025.12 via Frontend Transport; Wed, 22 Nov 2023 14:44:21 +0000 Received: ("Tessian outbound 385ad2f98d71:v228"); Wed, 22 Nov 2023 14:44:20 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: a7062903718f56cc X-CR-MTA-TID: 64aa7808 Received: from a6ecd502c14d.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id BC17311E-1E1E-4ADB-A28A-13B6012DFE53.1; Wed, 22 Nov 2023 14:44:14 +0000 Received: from EUR02-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id a6ecd502c14d.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 22 Nov 2023 14:44:14 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YTc8mp9tNvLIh8ZruTu51H/XodR7NBj9aH3ieNsbN9uiWrqub82FovyKDt2sz0CSaLtsVnfvf5rjfl/5FkQ/F3c7JPB3uSQQIH/4n0DuTh448sCtpTqi6JHzu3EZvCOsGfByW1LTQ46CTq0firkATAGPAAKFNdVDyb7kW1WIY29TsOtQrhDU4ptL/sB7PkIkBt9NcRFxWW8iBJhh8Y9uqnfAwnR5okX85rPvMnvMZdtqLU0rijCXCTXQNsCVVYsA/06m1lWtzc6GGCJEtDiat1QKmqXE5WEvONhLDj0CPA4Hn2LC19NltAD7ED9V3qBNsv1108VZaFWRHw40WbRqRA== 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=gum0x3g4ipAhlrmqCngYMXgl9b92HocOIXMZYA13YbY=; b=Ajdyfe/F3zC5TmpigTppb14mrReBynfO/g6GZB+7VLnVesxNc9okK7cZJWIGnaFKSXbX66Hm1XwCs50FB+XgezR1Gs8VlZfD1KYaM+6Pg/F/8SgdezfpnfGI6JJBUrRZZ09FWMtcc6gWQ3mYTxyv9QCUpOjUa5UHBuoFsPMSmYMT9uK5iKnBRCiY6bZiuiLxtQ/2Uxp/HLpP8R/DF9ZElFK03tCpdQxbRsrbQDS5wB3snMJX5qNkxIWtaXF9LffsffeS0SIHaQbnpLK2oE/FJXCB4mUK2h7lS4mdvhFpaoVgHnLgcL/YsoCxclAe6270qEdZO9THwADNcndoVAFDDw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=gum0x3g4ipAhlrmqCngYMXgl9b92HocOIXMZYA13YbY=; b=JCBxdgriV2CDBb7bw3fg/b0KgWUpCj4mbeFdQfqB+xnI2emYNud4tO7YzbGmIkCAAFqcp36s8QBQl0Ijxm9fXECwiQOG8YxsmGlG4em8fp2zRDdwwZchN/7BZNvc0HiFZBS+8jeXg++5x2Czzm26cMPDjD1IuY0F56qHySkrkFI= Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; Received: from PAWPR08MB8958.eurprd08.prod.outlook.com (2603:10a6:102:33e::15) by AS2PR08MB9046.eurprd08.prod.outlook.com (2603:10a6:20b:5fc::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7002.28; Wed, 22 Nov 2023 14:44:11 +0000 Received: from PAWPR08MB8958.eurprd08.prod.outlook.com ([fe80::8512:cc10:24d4:1919]) by PAWPR08MB8958.eurprd08.prod.outlook.com ([fe80::8512:cc10:24d4:1919%5]) with mapi id 15.20.7002.028; Wed, 22 Nov 2023 14:44:11 +0000 Date: Wed, 22 Nov 2023 14:44:06 +0000 From: Alex Coplan To: gcc-patches@gcc.gnu.org, Kyrylo Tkachov , richard.sandiford@arm.com Subject: Re: [PATCH 01/11] rtl-ssa: Support for inserting new insns Message-ID: References: Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-ClientProxiedBy: LO4P265CA0169.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:312::6) To PAWPR08MB8958.eurprd08.prod.outlook.com (2603:10a6:102:33e::15) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: PAWPR08MB8958:EE_|AS2PR08MB9046:EE_|AMS0EPF000001A9:EE_|GVXPR08MB10763:EE_ X-MS-Office365-Filtering-Correlation-Id: e66842fd-66ad-435f-b377-08dbeb698363 x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: xqE/MHzdfyKN33O8J/yLwmQ65nu9D7uu2RCmCPYBQTfNDi8DlLSx0jsa1vQY+SGE8fGMjJZlxu4h1em4eMdvyfC3SDffHpGIcVODXcx6qHJV6boLMTTkgFm0XqEVyglZNEFHm53BvP0HC2D/xAJ3rP+o2Bx1RbFhXqQpVEiytY6ntXxxE7HnQBVO+RLsNPxoazSttb99D2Y2Om+jtkXUMpukAuN4o2oYHgNKSqR2BZ2xQz7cUe1DaTEHqBOpmTnAZFySDXwDBQbmJW0wH3io24ng3OnbWoibzIiOJP9xkEJmL8FY1JgPYn6EnXtACUq0BLHABBmJa18JOFMxDOC9WX0Ypg90PtRhmWAU+Q5vzugz0+9UDcdkfrFu5Ii8L3PkyoIfJ9zaWpZK7LRhFTssbaaoP1NI/9nvrLnCHWr43YjWfkNT0f7dOzw78UGtcUI+AqRo9nmtSAWYwq+EsQmE9xPldpQ8Rq0A78H0ghwsnJD9nTfGtOFV9tIr4V/3aA54bBZ0ANgy6BE9V6/gZJ9mWq1Mje/PNGXD9ij9uZRKc/0= X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAWPR08MB8958.eurprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(396003)(346002)(366004)(376002)(39860400002)(136003)(230922051799003)(186009)(1800799012)(64100799003)(451199024)(2616005)(83380400001)(38100700002)(26005)(6512007)(6506007)(53546011)(66946007)(6666004)(966005)(478600001)(6486002)(316002)(66476007)(66556008)(6636002)(5660300002)(86362001)(44832011)(2906002)(8936002)(8676002)(41300700001)(36756003);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS2PR08MB9046 Original-Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AMS0EPF000001A9.eurprd05.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: dfb1ff23-129a-47f7-ef73-08dbeb697d15 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: DYuCbUzrG2pRK2p0cQlH2ZA0H/b5PMsEJSbfhlsLXaxwNnRegZ3z0wvzDLVOirqbGVAfU0zfUpjJ2O14p5MjwCi4HFPjmA6RgOb0VfqYmgHDLNPxDzAl5RNej8CP7M5h6D03l9zV7Y4LZa6+o5JRA5ICNFjYOYr/5mRrtT74omzRR73BihVlPdQ/y1q2QfJIR3plF29IGwL/O5CQPVQRL4/1aSvs8bEOFFnVxFQhRbKF7g3gz3UnyBGzorWZ5MJG1a2B3ISfONFHvsWnmVNZxdhGEMZJvi+PEMzX/RnYJ99k+kUreRvA8cHNknuiX5NZ+S0aya+PkxVtqToa+OcloQyVytHnwllGWZG4Rny5qOmzM+cGaix3PtZU6k7Hrsz7j7hfqOJZ0ELWGy0D1t8rqJgWQ03NIPMR2rqOGP/GgBoub3dth3rAGBeuLYBUSfQ/f/Rr7VVAtR2ygFRvwZ9CdnmEqu/+80srIpHslMo4UWHUJgXPuRKtYG185MWa54NWxjn+dGC6uMYt3l4ebRhbJ2PNo4r7dMbVkb1WKHr578LBa0zsQNLk9zrW1HNuRmI708zG10+H+dy+GvltZUGzW+7wd0dHVA7hYds5GHQ6mUQxfEXPO5BLy5AFvIYh4s8XtucCt4IaiLOpWDFHVxv7y0RFAQGvC70hPHfQQrAf2XTsq9139jE44ZlVLqYaeCO5KlU2cpgWNEEf+449gnWKrbeealcfYg5H366OnG0FASY= X-Forefront-Antispam-Report: CIP:63.35.35.123;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-1.mta.getcheckrecipient.com;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;CAT:NONE;SFS:(13230031)(4636009)(39860400002)(376002)(136003)(396003)(346002)(230922051799003)(1800799012)(82310400011)(186009)(64100799003)(451199024)(46966006)(40470700004)(36840700001)(5660300002)(40480700001)(44832011)(2906002)(8936002)(41300700001)(8676002)(70206006)(6636002)(316002)(70586007)(40460700003)(47076005)(86362001)(6486002)(26005)(478600001)(966005)(356005)(6512007)(53546011)(6666004)(81166007)(36756003)(6506007)(2616005)(336012)(83380400001)(36860700001)(82740400003);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Nov 2023 14:44:21.0718 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e66842fd-66ad-435f-b377-08dbeb698363 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.35.35.123];Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: AMS0EPF000001A9.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: GVXPR08MB10763 X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,FORGED_SPF_HELO,GIT_PATCH_0,KAM_DMARC_NONE,KAM_SHORT,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 21/11/2023 11:51, Richard Sandiford wrote: > Alex Coplan writes: > > N.B. this is just a rebased (but otherwise unchanged) version of the > > same patch already posted here: > > > > https://gcc.gnu.org/pipermail/gcc-patches/2023-October/633348.html > > > > this is the only unreviewed dependency from the previous series, so it > > seemed easier just to re-post it (not least to appease the pre-commit > > CI). > > > > -- >8 -- > > > > The upcoming aarch64 load pair pass needs to form store pairs, and can > > re-order stores over loads when alias analysis determines this is safe. > > In the case that both mem defs have uses in the RTL-SSA IR, and both > > stores require re-ordering over their uses, we represent that as > > (tentative) deletion of the original store insns and creation of a new > > insn, to prevent requiring repeated re-parenting of uses during the > > pass. We then update all mem uses that require re-parenting in one go > > at the end of the pass. > > > > To support this, RTL-SSA needs to handle inserting new insns (rather > > than just changing existing ones), so this patch adds support for that. > > > > New insns (and new accesses) are temporaries, allocated above a temporary > > obstack_watermark, such that the user can easily back out of a change without > > awkward bookkeeping. > > > > Bootstrapped/regtested as a series on aarch64-linux-gnu, OK for trunk? > > > > gcc/ChangeLog: > > > > * rtl-ssa/accesses.cc (function_info::create_set): New. > > * rtl-ssa/accesses.h (access_info::is_temporary): New. > > * rtl-ssa/changes.cc (move_insn): Handle new (temporary) insns. > > (function_info::finalize_new_accesses): Handle new/temporary > > user-created accesses. > > (function_info::apply_changes_to_insn): Ensure m_is_temp flag > > on new insns gets cleared. > > (function_info::change_insns): Handle new/temporary insns. > > (function_info::create_insn): New. > > * rtl-ssa/changes.h (class insn_change): Make function_info a > > friend class. > > * rtl-ssa/functions.h (function_info): Declare new entry points: > > create_set, create_insn. Declare new change_alloc helper. > > * rtl-ssa/insns.cc (insn_info::print_full): Identify temporary insns in > > dump. > > * rtl-ssa/insns.h (insn_info): Add new m_is_temp flag and accompanying > > is_temporary accessor. > > * rtl-ssa/internals.inl (insn_info::insn_info): Initialize m_is_temp to > > false. > > * rtl-ssa/member-fns.inl (function_info::change_alloc): New. > > * rtl-ssa/movement.h (restrict_movement_for_defs_ignoring): Add > > handling for temporary defs. > > Looks good, but there were a couple of things I didn't understand: Thanks for the review. > > > --- > > gcc/rtl-ssa/accesses.cc | 10 ++++++ > > gcc/rtl-ssa/accesses.h | 4 +++ > > gcc/rtl-ssa/changes.cc | 74 +++++++++++++++++++++++++++++++------- > > gcc/rtl-ssa/changes.h | 2 ++ > > gcc/rtl-ssa/functions.h | 14 ++++++++ > > gcc/rtl-ssa/insns.cc | 5 +++ > > gcc/rtl-ssa/insns.h | 7 +++- > > gcc/rtl-ssa/internals.inl | 1 + > > gcc/rtl-ssa/member-fns.inl | 12 +++++++ > > gcc/rtl-ssa/movement.h | 8 ++++- > > 10 files changed, 123 insertions(+), 14 deletions(-) > > > > diff --git a/gcc/rtl-ssa/accesses.cc b/gcc/rtl-ssa/accesses.cc > > index 510545a8bad..76d70fd8bd3 100644 > > --- a/gcc/rtl-ssa/accesses.cc > > +++ b/gcc/rtl-ssa/accesses.cc > > @@ -1456,6 +1456,16 @@ function_info::make_uses_available (obstack_watermark &watermark, > > return use_array (new_uses, num_uses); > > } > > > > +set_info * > > +function_info::create_set (obstack_watermark &watermark, > > + insn_info *insn, > > + resource_info resource) > > +{ > > + auto set = change_alloc (watermark, insn, resource); > > + set->m_is_temp = true; > > + return set; > > +} > > + > > // Return true if ACCESS1 can represent ACCESS2 and if ACCESS2 can > > // represent ACCESS1. > > static bool > > diff --git a/gcc/rtl-ssa/accesses.h b/gcc/rtl-ssa/accesses.h > > index fce31d46717..7e7a90ece97 100644 > > --- a/gcc/rtl-ssa/accesses.h > > +++ b/gcc/rtl-ssa/accesses.h > > @@ -204,6 +204,10 @@ public: > > // in the main instruction pattern. > > bool only_occurs_in_notes () const { return m_only_occurs_in_notes; } > > > > + // Return true if this is a temporary access, e.g. one created for > > + // an insn that is about to be inserted. > > + bool is_temporary () const { return m_is_temp; } > > + > > protected: > > access_info (resource_info, access_kind); > > > > diff --git a/gcc/rtl-ssa/changes.cc b/gcc/rtl-ssa/changes.cc > > index aab532b9f26..da2a61d701a 100644 > > --- a/gcc/rtl-ssa/changes.cc > > +++ b/gcc/rtl-ssa/changes.cc > > @@ -394,14 +394,20 @@ move_insn (insn_change &change, insn_info *after) > > // At the moment we don't support moving instructions between EBBs, > > // but this would be worth adding if it's useful. > > insn_info *insn = change.insn (); > > - gcc_assert (after->ebb () == insn->ebb ()); > > + > > bb_info *bb = after->bb (); > > basic_block cfg_bb = bb->cfg_bb (); > > > > - if (insn->bb () != bb) > > - // Force DF to mark the old block as dirty. > > - df_insn_delete (rtl); > > - ::remove_insn (rtl); > > + if (!insn->is_temporary ()) > > + { > > + gcc_assert (after->ebb () == insn->ebb ()); > > + > > + if (insn->bb () != bb) > > + // Force DF to mark the old block as dirty. > > + df_insn_delete (rtl); > > + ::remove_insn (rtl); > > + } > > + > > ::add_insn_after (rtl, after_rtl, cfg_bb); > > } > > > > @@ -439,10 +445,15 @@ function_info::finalize_new_accesses (insn_change &change, insn_info *pos) > > gcc_assert (def); > > if (def->m_is_temp) > > { > > - // At present, the only temporary instruction definitions we > > - // create are clobbers, such as those added during recog. > > - gcc_assert (is_a (def)); > > - def = allocate (change.insn (), ref.regno); > > + if (is_a (def)) > > + def = allocate (change.insn (), ref.regno); > > + else if (is_a (def)) > > + { > > + def->m_is_temp = false; > > + def = allocate (change.insn (), def->resource ()); > > Why is it necessary to clear is_temp on the old temporary set, > when it wasn't for the temporary clobber? In the case of a store pair insn (in the parallel form), I think we will see two writes of memory in properties.refs (). If we're inserting a new stp insn with a newly-created set of memory, then we must ensure that we only try to add one def of memory to m_temp_defs, or we will get an invalid access array. If we don't clear m_is_temp on the old def, then we will allocate and push two defs of memory in this case, which is clearly wrong. I don't think the same situation can happen with clobbers. AIUI, non-memory resources can only have at most one write in properties.refs (). Having said that, and having looked again at the code more closely, I don't think clearing the flag alone is the right solution, as the second time we process a memory write in this case, we will call record_reference against the old (temporary) def, and thus any changes made by record_reference will be lost. I think instead we should replace the temporary def with the newly-allocated (permanent) def in change.new_defs, and then push a pointer to this new def to m_temp_defs. So perhaps we could use find_access_index instead of find_access, and in the case that we find a temporary def, do something like: def = allocate (change.insn (), def->resource ()); change.new_defs[def_index] = def; WDYT? > > > + } > > + else > > + gcc_unreachable (); > > } > > else if (!def->m_has_been_superceded) > > { > > @@ -511,7 +522,9 @@ function_info::finalize_new_accesses (insn_change &change, insn_info *pos) > > unsigned int i = 0; > > for (use_info *use : change.new_uses) > > { > > - if (!use->m_has_been_superceded) > > + if (use->m_is_temp) > > + use->m_has_been_superceded = true; > > + else if (!use->m_has_been_superceded) > > Where do the temporary uses come from? It doesn't look like this patch > itself provided a new means of creating them. Ah, sorry, I think this is a hold-over from a previous iteration of the patch where we did provide an entry point for creating new uses. I dropped it in favour of teaching RTL-SSA to infer uses of mem (g:505f1202e3a1a1aecd0df10d0f1620df6fea4ab5). I'll drop this in the next iteration of the patch. Thanks, Alex > > Thanks, > Richard > > > { > > use = allocate_temp (insn, use->resource (), use->def ()); > > use->m_has_been_superceded = true; > > @@ -645,6 +658,8 @@ function_info::apply_changes_to_insn (insn_change &change) > > > > insn->set_accesses (builder.finish ().begin (), num_defs, num_uses); > > } > > + > > + insn->m_is_temp = false; > > } > >