| Message ID | orldmix3cw.fsf@lxoliva.fsfla.org |
|---|---|
| Headers |
Return-Path: <gcc-patches-bounces~patchwork=sourceware.org@gcc.gnu.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C17093857C7F for <patchwork@sourceware.org>; Sat, 13 Sep 2025 06:41:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C17093857C7F Authentication-Results: sourceware.org; dkim=pass (2048-bit key, secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256 header.s=google header.b=IivfYR/5 X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-pf1-x42c.google.com (mail-pf1-x42c.google.com [IPv6:2607:f8b0:4864:20::42c]) by sourceware.org (Postfix) with ESMTPS id 77E713857C4F for <gcc-patches@gcc.gnu.org>; Sat, 13 Sep 2025 06:40:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 77E713857C4F Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 77E713857C4F Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::42c ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1757745613; cv=none; b=nbmHtP5x53M95TEita6htFND1IcU4vSW4JIrIrrWT7rsxJXp1MSnW/N21BbwVTp7OZydK1fn/a+fYOC21Usxu46qhiKfOtgh11iGv1DWh+f+pBECVXBIGP1BkY8Fv1uJUfdgAGQGIrREjveQMSdI63BIHYOkx2cdwGtzLSpuKek= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1757745613; c=relaxed/simple; bh=Ax5gewFSNY4Aa7NcPn2f04LcBGnt2hXsW9QbUMu6Ytw=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=O4/1KeVhIonIKwtH8UNQBtXomJLNkdyqqvWQP8UwbqTWyAEhwS4TCBGxnThcMN1LrITeSm3jObyNtnPG3KQQB3JobiHBXtEuZ29Hj3HGkNfss3tE6MMH6HMoewMaflzEWYHZJv5qJqb46+pAB+EXD7SqcUC4cU7gUw/pNQhVWZ0= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 77E713857C4F Received: by mail-pf1-x42c.google.com with SMTP id d2e1a72fcca58-76e2ea933b7so2561653b3a.1 for <gcc-patches@gcc.gnu.org>; Fri, 12 Sep 2025 23:40:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1757745612; x=1758350412; darn=gcc.gnu.org; h=mime-version:user-agent:message-id:date:organization:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=L0OHgdn5TdjT2NxAFMwXOE45DqpPJyiipXIJId8RE/Y=; b=IivfYR/5/JCpuNbV6dnj0H7gPE3tL2JNpIM0m0jbjFgX995jps1xikSrz7I7k0Na+Y AcnXqRAr+/pVxjo4EW76jVuUV+YSGpN+fMEcmGHB4tgHz1bM45l05p+ToW8BWFrPHAeM MiofU/qmRheCkP8Qq9wn7/u618p5haIb4ALrtcAYh3AxFWSZhxQ+zxlG6/n1wxIz4hm8 C/kQFXDSPQcb7jKy/vo7ujInpHqVBHTzCnqPoH/yhbS/ZPHYnICRdBWyD5XMuBuBHU7h 8Cv6EcgXCuZWNzLrRGl1mlAA3fSHRw3VQQlPLuERITVEs/eFa/ubIERewL2O2ytOcOWv h+PQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1757745612; x=1758350412; h=mime-version:user-agent:message-id:date:organization:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=L0OHgdn5TdjT2NxAFMwXOE45DqpPJyiipXIJId8RE/Y=; b=ee3JHnkJ5R/3yMmYf78rIvRFsFmEd7e1Ky13onUmy4+cP85Bo69w5mKHbb3Sck5CPo dPSqTdaeKTEN4xR6TVSvEGIFSqkPtRvzKpNsWnNFEa18AA2AbGaamQvh9nY9R2WEqVfY vx84yR9swncxoMuXMKFHyw5e7rCp83NdeB/hsPc3fUb/CjzrPR3VobX9OoiBWm+19mVW Gi/mpTOGegPKTtwndrbfQs+s9GiBJJO3nhKCp752JoMDwW60HCgfw4egUpg8kAJt4k2E FmeAYhmd4nviZAzb48ZoStB/TVZX/+VASr67cRA1AmjhHqA03ndebwI7H+QeIazSnYYy j8Xw== X-Gm-Message-State: AOJu0Yxd6ZJraRRq5P6iE78gMTfHuXYzvUBgF09UVPYP2HPsGSq612l9 Ku5ta4UFwSONhkXZqJ48U5Iv76+5wQZLQk5wNvK0AAgtn4zoKzmG4uIFRXHxViD0Qwz9nkF4lMV IdhBorg== X-Gm-Gg: ASbGnctdPjz/wI1JJOmRMilM2ZsQl4xcmUSJSxKMPlb/p9u5kmK9zV786PAqlBSWE5y IA2CYK2oDlWTJBuN5ogys7xcWvSppmQxtPng794cTcZlYzbrYpdoutlc9RVU9i/1wLDjjCS2MVe 3J2BMMihbCcGSKRCHl49Tk/55V4Quwil9/Xx+ckiJPXBBy6d6uXAeYQJyLkMquqUDh+KHJLs2Bl ef9QL301v1Xk6oV2KRIBgNdLrK69NO2rbw/2ruDPGedvYDRfG7n6eVn8K4TVpwl5u02NQ2ZJcme nq//+qriHMzkmGThw+fQ3Phn6FH6c0ax09cSvHVLRsge5yO2VCxiOdHskWj5PnH8XxSnLh37ilM = X-Google-Smtp-Source: AGHT+IGLzrjFkvAA43fjibxeg3z/Q2SwkNXUJD/SbN4LidEAVQWWOHpYxhyhdRCQBStebDqoWKTvqA== X-Received: by 2002:a05:6a21:3285:b0:240:d6be:ddc with SMTP id adf61e73a8af0-25d0aad2601mr12477613637.21.1757745612436; Fri, 12 Sep 2025 23:40:12 -0700 (PDT) Received: from free.home ([2804:14c:4d1:41a6::2000]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-b54a398cfbasm6505619a12.39.2025.09.12.23.40.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Sep 2025 23:40:11 -0700 (PDT) Received: from livre (livre.home [172.31.160.2]) by free.home (8.15.2/8.15.2) with ESMTPS id 58D6dxTS2082999 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Sat, 13 Sep 2025 03:40:01 -0300 From: Alexandre Oliva <oliva@adacore.com> To: gcc-patches@gcc.gnu.org Cc: Vladimir Makarov <vmakarov@redhat.com>, Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>, Mike Stump <mikestump@comcast.net>, Richard Earnshaw <richard.earnshaw@arm.com>, Tamar Christina <tamar.christina@arm.com>, Kyrylo Tkachov <ktkachov@nvidia.com> Subject: [PATCH 0/2] [aarch64] sme/nonlocal_goto_* tests fail remat with PIE Organization: Free thinker, does not speak for AdaCore Date: Sat, 13 Sep 2025 03:39:59 -0300 Message-ID: <orldmix3cw.fsf@lxoliva.fsfla.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Scanned-By: MIMEDefang 2.84 X-Spam-Status: No, score=-6.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, WEIRD_QUOTING 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.30 Precedence: list List-Id: Gcc-patches mailing list <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> Errors-To: gcc-patches-bounces~patchwork=sourceware.org@gcc.gnu.org |
| Series |
sme/nonlocal_goto_* tests fail remat with PIE
|
|
Message
Alexandre Oliva
Sept. 13, 2025, 6:39 a.m. UTC
gcc.target/aarch64/sme/nonlocal_goto_[123].c fail on aarch64 targets configured with --enable-default-pie. Instead of expected 'add' insns that would compute the address of a stack slot to pass to a function, after setting up a trampoline and calling the instruction cache sync function with the same address, when PIE is enabled we get an 'ldr' instead. That's because we fail to rematerialize the address of the stack slot, and so we allocate another pseudo to hold the address across the cache sync call, and then restore it, as it happens, from memory. I suspect that's a register allocation bug, and at least part of it seems to be related with dropping function_invariant equivalences when flag_pic is nonzero in setup_reg_equiv, but the upcoming patch for that is not enough for rematerialization to succeed in lra, but it is enough to avoid the allocation of yet another pseudo in ira. Anyhow, I am going to propose two different versions of workarounds for the testcases, one (1v1) that tolerates the missed optimization, and another (1v2) that forces PIE off to avoid running into the problem. The second patch is for ira to retain the equivalence but, as mentioned above, it is *not* enough for us to output the expected code, for reasons I'm yet to investigate.
Comments
On Sep 13, 2025, Alexandre Oliva <oliva@adacore.com> wrote: > gcc.target/aarch64/sme/nonlocal_goto_[123].c fail on aarch64 targets > configured with --enable-default-pie. FTR, Martin's commit afa74d37e8170d696f97424da7ab0f71883aac70 regressed nonlocal_goto_2.c in a slightly different way, even in a standard aarch64-elf build. I was surprised that the warning patch caused any codegen changes, but it seems to prevent collapsing the nonlocal label with the return block it falls through to, and the expected code pattern no longer matches because the separation survives through to the end of compilation, with an extra smstart and padding.
On Mon, Sep 15, 2025 at 3:59 PM Alexandre Oliva <oliva@adacore.com> wrote: > > On Sep 13, 2025, Alexandre Oliva <oliva@adacore.com> wrote: > > > gcc.target/aarch64/sme/nonlocal_goto_[123].c fail on aarch64 targets > > configured with --enable-default-pie. > > FTR, Martin's commit afa74d37e8170d696f97424da7ab0f71883aac70 regressed > nonlocal_goto_2.c in a slightly different way, even in a standard > aarch64-elf build. I was surprised that the warning patch caused any > codegen changes, but it seems to prevent collapsing the nonlocal label > with the return block it falls through to, and the expected code pattern > no longer matches because the separation survives through to the end of > compilation, with an extra smstart and padding. Yes the problem with non-local lable/goto's is recorded already as https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121933 . It caused gcs-nonlocal-1-track-speculation.c to fail too. Thanks, Andrew > > -- > Alexandre Oliva, happy hacker https://blog.lx.oliva.nom.br/ > Free Software Activist FSFLA co-founder GNU Toolchain Engineer > More tolerance and less prejudice are key for inclusion and diversity. > Excluding neuro-others for not behaving ""normal"" is *not* inclusive!
Am Montag, dem 15.09.2025 um 16:04 -0700 schrieb Andrew Pinski: > On Mon, Sep 15, 2025 at 3:59 PM Alexandre Oliva <oliva@adacore.com> wrote: > > > > On Sep 13, 2025, Alexandre Oliva <oliva@adacore.com> wrote: > > > > > gcc.target/aarch64/sme/nonlocal_goto_[123].c fail on aarch64 targets > > > configured with --enable-default-pie. > > > > FTR, Martin's commit afa74d37e8170d696f97424da7ab0f71883aac70 regressed > > nonlocal_goto_2.c in a slightly different way, even in a standard > > aarch64-elf build. I was surprised that the warning patch caused any > > codegen changes, but it seems to prevent collapsing the nonlocal label > > with the return block it falls through to, and the expected code pattern > > no longer matches because the separation survives through to the end of > > compilation, with an extra smstart and padding. > > Yes the problem with non-local lable/goto's is recorded already as > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121933 . > It caused gcs-nonlocal-1-track-speculation.c to fail too. Sorry, for that. The fix shown there is bootstrapped and regression tested on aarch64. I am travelling now but plan to submit it at the end of the week. But it would certainly be nice if we *could* use the DECL_NONLOCAL bit in the FE to track this information for decls. So I am do not know what consequences this might have, but if it could be made to work I would prefer this. Martin