From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ot1-x32c.google.com (mail-ot1-x32c.google.com [IPv6:2607:f8b0:4864:20::32c]) by sourceware.org (Postfix) with ESMTPS id 966823858024 for ; Mon, 2 Nov 2020 20:12:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 966823858024 Received: by mail-ot1-x32c.google.com with SMTP id 32so13846145otm.3 for ; Mon, 02 Nov 2020 12:12:14 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Q93meu2vBoOZV/XegElsJ7lZcjrQDi6eQHm2OacsPGA=; b=nd7MBbEdv95Kh4Y4PQbb5zwyvyLxlzjPjmyLvQ/F3eIVKY4SWgQ3WyWcIUPdYKy2TN rcFRy0Szz4bXpuo75RxpjoUG3W67SRj9pzwT3RJQxOZhfZBgJLd6XrPj5Xux6Vb1VBFe QePlOioni14aETjyr95gqyK/1lxW1yEXMjpBahgqld80FrxsHLSe7YZK1udG2VX+2XT3 o7BFKb4H0JjIJZ1UUt47fexGV8SjipD1iGZy0iEX8Q0ew6ay3AwHnxgxzzvqy9NXea0M ODy5SukPcgaM/QRqKamBUOKLg+7ZPdZVkgSfB5sNdaHQmQlTKrT/wQebnBDkB3dlQZZG n2Bg== X-Gm-Message-State: AOAM530dAJJ2+xZqPI1WJykhjzZ4NHqJoO2ORIUcfemsidLhcwD3oGuM o3wPEELwpxsHhufd7DqW3agcnQPBx1Q3TwyGSgETWw== X-Google-Smtp-Source: ABdhPJxt+XpNwze4S305kc+J2Cyw9gSHnAnmfrt1EroaTDIQ9dS7PB2sZReEaJ4kvlYEyVQPQVdER4TzESTb/nAlGAM= X-Received: by 2002:a9d:6307:: with SMTP id q7mr13560445otk.218.1604347933842; Mon, 02 Nov 2020 12:12:13 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Christophe Lyon Date: Mon, 2 Nov 2020 21:12:03 +0100 Message-ID: Subject: Re: [committed] patch to deal with insn scratches in global RA To: Vladimir Makarov Cc: "gcc-patches@gcc.gnu.org" Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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-List-Received-Date: Mon, 02 Nov 2020 20:12:16 -0000 On Fri, 30 Oct 2020 at 20:11, Vladimir Makarov via Gcc-patches wrote: > > The following patch implements taking insn scratch requirements into > account in global RA (IRA). Before the patch IRA simply ignored insn > scratches. Only LRA took the scratches into account and assigned hard > registers to scratches if neccessary. In some cases it resulted in > spilling pseudos who got hard registers in IRA and as a consequence in > violating a good IRA assignment. > > The patch changes insn scratches which require registers for all > insn alternatives (in other words w/o X constraint in scratch > constraint string). This is done before IRA staring its work. LRA > still continue to change the rest scratches (with X constraint and in > insn created during IRA) into pseudos. As before the patch at the end > of LRA work, spilled scratch pseudos (for which X constraint was > chosen) changed into scratches back. > > The patch was successfully bootstrapped and tested on x86-64, ppc64, > aarch64, s390x. There are few new GCC test failures on ppc64 and > s390x which can be fixed by adding hints to scratch constraints in ppc > md file and by changing expected test output (as hard register > assignment was changed a bit). I'll submit the patches for approval a > bit later. > > > 2020-10-30 Vladimir Makarov > > * lra.c (get_scratch_reg): New function. > (remove_scratches_1): Rename remove_insn_scratches. Use > ira_remove_insn_scratches and get_scratch_reg. > (remove_scratches): Do not > initialize scratches, scratch_bitmap, and scratch_operand_bitmap. > (lra): Call ira_restore_scratches instead of restore_scratches. > (struct sloc, sloc_t, scratches, scratch_bitmap) > (scratch_operand_bitmap, lra_former_scratch_p) > (lra_former_scratch_operand_p, lra_register_new_scratch_op, > restore_scratches): Move them to ... > * ira.c: ... here. > (former_scratch_p, former_scratch_operand_p): Rename to > ira_former_scratch_p and ira_former_scratch_operand_p. > (contains_X_constraint_p): New function. > (register_new_scratch_op): Rename to ira_register_new_scratch_op. > Change it to work for IRA and LRA. > (restore_scratches): Rename to ira_restore_scratches. > (get_scratch_reg, ira_remove_insn_scratches): New functions. > (ira): Call ira_remove_scratches if we use LRA. > * ira.h (ira_former_scratch_p, ira_former_scratch_operand_p): New > prototypes. > (ira_register_new_scratch_op, ira_restore_scratches): New > prototypes. > (ira_remove_insn_scratches): New prototype. > * lra-int.h (lra_former_scratch_p, lra_former_scratch_operand_p): > Remove prototypes. > (lra_register_new_scratch_op): Ditto. > * lra-constraints.c: Rename lra_former_scratch_p and > lra_former_scratch_p to ira_former_scratch_p and to > ira_former_scratch_p. > * lra-remat.c: Ditto. > * lra-spills.c: Rename lra_former_scratch_p to > ira_former_scratch_p. > Hi, This patch causes ICEs on arm (eg arm-none-linux-gnueabi) gcc.c-torture/compile/sync-3.c -O1 (internal compiler error) gcc.c-torture/compile/sync-3.c -O2 (internal compiler error) gcc.c-torture/compile/sync-3.c -O2 -flto -fno-use-linker-plugin -flto-partition=none (internal compiler error) gcc.c-torture/compile/sync-3.c -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects (internal compiler error) gcc.c-torture/compile/sync-3.c -O3 -g (internal compiler error) gcc.c-torture/compile/sync-3.c -Os (internal compiler error) gcc.log says: FAIL: gcc.c-torture/compile/sync-3.c -O1 (internal compiler error) PASS: gcc.c-torture/compile/sync-3.c -O1 (test for warnings, line ) FAIL: gcc.c-torture/compile/sync-3.c -O1 (test for excess errors) Excess errors: during RTL pass: ira /gcc/testsuite/gcc.c-torture/compile/sync-3.c:85:1: internal compiler error: Segmentation fault 0xcf8b1f crash_signal /gcc/toplev.c:330 0xaeb0a0 fix_reg_equiv_init /gcc/ira.c:2671 0xaf2113 find_moveable_pseudos /gcc/ira.c:4874 0xaf48e8 ira /gcc/ira.c:5533 0xaf48e8 execute /gcc/ira.c:5861 FAIL: gcc.c-torture/compile/sync-3.c -O2 (internal compiler error) PASS: gcc.c-torture/compile/sync-3.c -O2 (test for warnings, line ) FAIL: gcc.c-torture/compile/sync-3.c -O2 (test for excess errors) Excess errors: during RTL pass: ira /gcc/testsuite/gcc.c-torture/compile/sync-3.c:85:1: internal compiler error: Segmentation fault 0xcf8b1f crash_signal /gcc/toplev.c:330 0xaeb0a9 safe_as_a /gcc/is-a.h:210 0xaeb0a9 rtx_insn_list::next() const /gcc/rtl.h:1408 0xaeb0a9 fix_reg_equiv_init /gcc/ira.c:2683 0xaf2113 find_moveable_pseudos /gcc/ira.c:4874 0xaf48e8 ira /gcc/ira.c:5533 0xaf48e8 execute /gcc/ira.c:5861 Christophe