From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oo1-xc32.google.com (mail-oo1-xc32.google.com [IPv6:2607:f8b0:4864:20::c32]) by sourceware.org (Postfix) with ESMTPS id 31C993858C2A for ; Wed, 3 Jan 2024 04:20:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 31C993858C2A Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 31C993858C2A Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::c32 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704255647; cv=none; b=ZMJBfZwuoqQR7oXyltKSulHBAZV8s7+FVJBi+lqXOXxR9cVccwzjo0Lmipanrn3REtfB3BbEmpOPBcH3nqCC/+fKCohpcUPyPcHPbWId2FolqmuNsD4YNTO9swBqjZnB4Celth2jtQAdtQq1jmOmjtQ0ne5c9O+H5dAOZwnMKCQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704255647; c=relaxed/simple; bh=N08Zb74+UYWQrp0xeEO/4klS8+JWWAUNvaZR4s+HLlg=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=xmmx2KNNRoKNPahVkN5MLPmv8SR53OzTVYWxARVHeinMWZat9Ig96KfYfoCBQh3KJJa4P+DoVl6FFNnnGJE0kvW93BAQ5ms10yiE56kc4U+8dRmdh4Wo1aGuSia9ii6JR1dqBaqCr0rwTwMdM3Cj7lYR0RDmx4+UAv1zl6OPP4g= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-oo1-xc32.google.com with SMTP id 006d021491bc7-595471d17baso909194eaf.3 for ; Tue, 02 Jan 2024 20:20:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704255644; x=1704860444; darn=gcc.gnu.org; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=ul4FzZQjH9bJF6bhskIoMpSQByITyZcOdzmlad4XYVw=; b=iEktLPT4m8S2ekRtIcQuxVBEs9pry4Z0npkgz3GnEsW1L1GCnrwVHxPlemQ4AxOROy xlMom1aVNst1Trlsbhye24dbVmLOOFAWMLYObFHio3gOuRKP3xSFG+XUEpAtzY/SYSz6 4WTRj9i/J0UqEZt7m9v6lh3XFG/3yROEbRhIk10A9LX95yqJW7AU4u+pbmJaBvgVLFbx w/aDDT8py2nU+KEl2pQC9EwrZYf8BhT23o0rXjrY2HtEjxu4vGnXJQ1V3Y9ICQse5vDY hD9BAQN1kww/oeTZfb/jWsApiQTJX90jV4WXJVaIxjvd6UScnQHTt1hANXz+ERqClexZ 8+lg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704255644; x=1704860444; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ul4FzZQjH9bJF6bhskIoMpSQByITyZcOdzmlad4XYVw=; b=DqoWWkIdCl5oF5y2UOAod3Fpm0TjP/zRSMNOnG5lw9IVct25MnOOAT7PFMviLajd9p XEELUiSLdODtcmd4UWrzReQSfPUCdqcl2SZqwQolMrYou7zf9OeBGVd88wTfI3bmiQeY BTnWJB9/0I7oYJ2gAh+ClZNs+9QDloWOmFzp5wnV3t3Zl2nRxgJ1IXZ+2cLzPNkP5SU/ GifQxjWiarK9VEkveD23ly0hfJx1elUzINrqaNN+tZvBYu0UE3jHhlLiDegXMzut7OUz UVd4CyQjeFEB38huwoY3C7jjhC3oUUK4ACysfcs2xOrijFppVEP0LFoIbzTvPEnVC5QT qH3Q== X-Gm-Message-State: AOJu0YyeIu+KgRLGk9IXgQkDnQt4lPLjFpS9wSsZcjFtuYhlJ3kiLukL GpLuGzCWXnzBNpUK3PFZv1CTozlMaqs= X-Google-Smtp-Source: AGHT+IH9pB+X3tel24tHGO4nGy3Li/xG+3/VpzrsnupUmolunx7rgdFwqs3/aZbBs1aVGHdR7yR9sw== X-Received: by 2002:a05:6358:718b:b0:175:357d:f129 with SMTP id t11-20020a056358718b00b00175357df129mr1649350rwt.25.1704255644207; Tue, 02 Jan 2024 20:20:44 -0800 (PST) Received: from [172.31.0.109] ([136.36.72.243]) by smtp.gmail.com with ESMTPSA id ck4-20020a17090afe0400b0028ce12f8cdasm471458pjb.10.2024.01.02.20.20.43 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 02 Jan 2024 20:20:43 -0800 (PST) Message-ID: Date: Tue, 2 Jan 2024 21:20:30 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] Add a late-combine pass [PR106594] Content-Language: en-US To: gcc-patches@gcc.gnu.org, jlaw@ventanamicro.com, rdapp.gcc@gmail.com, richard.sandiford@arm.com References: From: Jeff Law In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,KAM_SHORT,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE 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 10/24/23 12:49, Richard Sandiford wrote: > This patch adds a combine pass that runs late in the pipeline. > There are two instances: one between combine and split1, and one > after postreload. So have you done any investigation on cases caught by your new pass between combine and split1 to characterize them? In particular do they point at solvable problems in combine? Or do you forsee this subsuming the old combiner pass at some point in the distant future? rth and I sketched out an SSA based RTL combine at some point in the deep past. The key goal we were trying to achieve was combining across blocks. We didn't have a functioning RTL SSA form at the time, so it never went to any implementation work. It looks like yours would solve the class of problems rth and I were considering. [ ... ] > > The patch therefore enables the pass by default only on AArch64. > However, I did test the patch with it enabled on x86_64-linux-gnu > as well, which was useful for debugging. > > Bootstrapped & regression-tested on aarch64-linux-gnu and > x86_64-linux-gnu (as posted, with no regressions, and with the > pass enabled by default, with some gcc.target/i386 regressions). > OK to install? I'm going to adjust this slightly so that it's enabled across the board and throw it into the tester tomorrow (tester is busy tonight). Even if we make it opt-in on a per-port basis, the alternate target testing does seems to find stuff that needs fixing ;-) > > Richard > > > gcc/ > PR rtl-optimization/106594 > * Makefile.in (OBJS): Add late-combine.o. > * common.opt (flate-combine-instructions): New option. > * doc/invoke.texi: Document it. > * common/config/aarch64/aarch64-common.cc: Enable it by default > at -O2 and above. > * tree-pass.h (make_pass_late_combine): Declare. > * late-combine.cc: New file. > * passes.def: Add two instances of late_combine. > > gcc/testsuite/ > PR rtl-optimization/106594 > * gcc.dg/ira-shrinkwrap-prep-1.c: Restrict XFAIL to non-aarch64 > targets. > * gcc.dg/ira-shrinkwrap-prep-2.c: Likewise. > * gcc.dg/stack-check-4.c: Add -fno-shrink-wrap. > * gcc.target/aarch64/sve/cond_asrd_3.c: Remove XFAILs. > * gcc.target/aarch64/sve/cond_convert_3.c: Likewise. > * gcc.target/aarch64/sve/cond_fabd_5.c: Likewise. > * gcc.target/aarch64/sve/cond_convert_6.c: Expect the MOVPRFX /Zs > described in the comment. > * gcc.target/aarch64/sve/cond_unary_4.c: Likewise. > * gcc.target/aarch64/pr106594_1.c: New test. > > + > + // Don't substitute into a non-local goto, since it can then be > + // treated as a jump to local label, e.g. in shorten_branches. > + // ??? But this shouldn't be necessary. > + if (use_insn->is_jump () > + && find_reg_note (use_insn->rtl (), REG_NON_LOCAL_GOTO, NULL_RTX)) > + return false; Agreed that this shouldn't be necessary. In fact, if you can substitute it's potentially very profitable. Then again, I doubt it happens all that much in practice, particularly since I think gimple does squash out some of these. Nothing jumps out at horribly wrong. You might want/need to reject frame related insns in optimizable_set, though I guess if the dwarf2 writer isn't complaining, then we haven't mucked things up too bad.