From nobody Sat Apr 20 10:32:11 2024 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VM79m11ZKz5HW0K; Sat, 20 Apr 2024 10:32:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4VM79l6JQvz4P6h; Sat, 20 Apr 2024 10:32:11 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1713609131; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=MmrI62zOiosAxQxb8BWiseBFRhKmcdtCtHJtd+h605Y=; b=fVJ/EHR36Q+UDhPkq78RZI3crec7U24wTDg2vIPsUMPnyE7WSTBS56fGKOOgbOVSmxaQXd mJmCsx+j4hX650EWYRxDxE387dLXUGpmrhF4L01siCXMZH/y0M36fu0C7BIkReDtw8ghBC ykSNinb5DLVqCO90R1yExpu9Si0/85rB2SNTFsPraKxuMBivEQfM1z8gNs8CqMg9MdkB/w 9jfSvt3sG7MNnZCAano7VEGXJ0+TX/lB2UnsUfkZwSWtOPsbebZLET3OfmBDFgkN5dUyde +KmcuHwHUtBYWVRY2eFfkirxXs54KFbG9bcaLctltuIJQ7gtltU5mynDTT54fA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1713609131; a=rsa-sha256; cv=none; b=S8nKOeUFP/BPcbmGNVS/IMmZeEBaUKuN5UrGTxv7TQz5FFtJ8q1ZHCwFG1UlJUrBhBajtc FjcQGidTNHv3ayq7w6OW9qn54lHuhhqQRmJqHDKpFUx7DH+xz/MLMf6vUcxpCF8ft88V+j 6piRdCpw7aMygnlMhS0yM8MBApvpfKOASqMCkpNW7cGEu+OdGDbQbJD29kZ+eAUoH+a78A t9SJV26AeG5wtt9Z6GUFoUOsSHMZwr04rnmme1Hgl7n0SmjIoyRFckixJGAbyQVi4YFgrA 19hMO7eO8pm0dcoX6TFI9ecY0yYam3fypHfpE5kXmU1JyKDp/PcUQTqfyiTPtA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1713609131; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=MmrI62zOiosAxQxb8BWiseBFRhKmcdtCtHJtd+h605Y=; b=Yj/Eq0GdtO1kEq4mDDHKgFO9QrFO0Tce/6ZFQJCoYrBNVMdciVDDKuLNr16SgKtLTl7EjL 1mlVvKQFyOj62wCnHELWbw5sIXvwQ+nQ4Jlbnrs2TT+oiVyLzcpb23PC6tgaOjld+KytO0 8MNgu/C6XT4i6UhV+vqLILzwGcUxsIKKiucyrQWRHX/faQi7Q8RVubctMV2A6BdcfQhziJ yj0SyEz9Pcys0ZdIlfXt/AN9RNkJBTt/DttzhR0l+3Auvx/weWyC6Lf8hsgGtUKbXGQZz2 7eM/ghEfZTjKViYARNJYg91UZhEOD8SlXjzMkS98H90s9H4uDfZheS2kVLCnmw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VM79l5wY7zYTx; Sat, 20 Apr 2024 10:32:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 43KAWBPo009441; Sat, 20 Apr 2024 10:32:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 43KAWBwN009438; Sat, 20 Apr 2024 10:32:11 GMT (envelope-from git) Date: Sat, 20 Apr 2024 10:32:11 GMT Message-Id: <202404201032.43KAWBwN009438@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dimitry Andric Subject: git: 7e83d42fa416 - stable/14 - Revert commit 0e46b49de433 from llvm-project (by Matt Arsenault): List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dim X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 7e83d42fa4164d54298ae7263fe44bddfe156536 Auto-Submitted: auto-generated The branch stable/14 has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=7e83d42fa4164d54298ae7263fe44bddfe156536 commit 7e83d42fa4164d54298ae7263fe44bddfe156536 Author: Dimitry Andric AuthorDate: 2024-01-02 16:07:31 +0000 Commit: Dimitry Andric CommitDate: 2024-04-19 21:12:23 +0000 Revert commit 0e46b49de433 from llvm-project (by Matt Arsenault): Reapply "RegisterCoalescer: Add implicit-def of super register when coalescing SUBREG_TO_REG" This reverts commit c398fa009a47eb24f88383d5e911e59e70f8db86. PPC backend was fixed in 2f82662ce901c6666fceb9c6c5e0de216a1c9667 Since it causes an assertion failure building /sys/dev/fb/vga.c: https://github.com/llvm/llvm-project/issues/76416 PR: 276104 MFC after: 1 month (cherry picked from commit edc2dc17b1f2dfe45dc85e6cc0ff54bca1ac8214) --- .../llvm/lib/CodeGen/RegisterCoalescer.cpp | 51 ++++------------------ 1 file changed, 9 insertions(+), 42 deletions(-) diff --git a/contrib/llvm-project/llvm/lib/CodeGen/RegisterCoalescer.cpp b/contrib/llvm-project/llvm/lib/CodeGen/RegisterCoalescer.cpp index 3fbb93795075..cbb1a74049fb 100644 --- a/contrib/llvm-project/llvm/lib/CodeGen/RegisterCoalescer.cpp +++ b/contrib/llvm-project/llvm/lib/CodeGen/RegisterCoalescer.cpp @@ -305,11 +305,7 @@ namespace { /// number if it is not zero. If DstReg is a physical register and the /// existing subregister number of the def / use being updated is not zero, /// make sure to set it to the correct physical subregister. - /// - /// If \p IsSubregToReg, we are coalescing a DstReg = SUBREG_TO_REG - /// SrcReg. This introduces an implicit-def of DstReg on coalesced users. - void updateRegDefsUses(Register SrcReg, Register DstReg, unsigned SubIdx, - bool IsSubregToReg); + void updateRegDefsUses(Register SrcReg, Register DstReg, unsigned SubIdx); /// If the given machine operand reads only undefined lanes add an undef /// flag. @@ -1347,7 +1343,8 @@ bool RegisterCoalescer::reMaterializeTrivialDef(const CoalescerPair &CP, if (DstReg.isPhysical()) { Register NewDstReg = DstReg; - unsigned NewDstIdx = TRI->composeSubRegIndices(CP.getSrcIdx(), DefSubIdx); + unsigned NewDstIdx = TRI->composeSubRegIndices(CP.getSrcIdx(), + DefMI->getOperand(0).getSubReg()); if (NewDstIdx) NewDstReg = TRI->getSubReg(DstReg, NewDstIdx); @@ -1496,7 +1493,7 @@ bool RegisterCoalescer::reMaterializeTrivialDef(const CoalescerPair &CP, MRI->setRegClass(DstReg, NewRC); // Update machine operands and add flags. - updateRegDefsUses(DstReg, DstReg, DstIdx, false); + updateRegDefsUses(DstReg, DstReg, DstIdx); NewMI.getOperand(0).setSubReg(NewIdx); // updateRegDefUses can add an "undef" flag to the definition, since // it will replace DstReg with DstReg.DstIdx. If NewIdx is 0, make @@ -1816,7 +1813,7 @@ void RegisterCoalescer::addUndefFlag(const LiveInterval &Int, SlotIndex UseIdx, } void RegisterCoalescer::updateRegDefsUses(Register SrcReg, Register DstReg, - unsigned SubIdx, bool IsSubregToReg) { + unsigned SubIdx) { bool DstIsPhys = DstReg.isPhysical(); LiveInterval *DstInt = DstIsPhys ? nullptr : &LIS->getInterval(DstReg); @@ -1856,8 +1853,6 @@ void RegisterCoalescer::updateRegDefsUses(Register SrcReg, Register DstReg, if (DstInt && !Reads && SubIdx && !UseMI->isDebugInstr()) Reads = DstInt->liveAt(LIS->getInstructionIndex(*UseMI)); - bool FullDef = true; - // Replace SrcReg with DstReg in all UseMI operands. for (unsigned i = 0, e = Ops.size(); i != e; ++i) { MachineOperand &MO = UseMI->getOperand(Ops[i]); @@ -1865,13 +1860,9 @@ void RegisterCoalescer::updateRegDefsUses(Register SrcReg, Register DstReg, // Adjust flags in case of sub-register joins. We don't want to // turn a full def into a read-modify-write sub-register def and vice // versa. - if (SubIdx && MO.isDef()) { + if (SubIdx && MO.isDef()) MO.setIsUndef(!Reads); - if (!Reads) - FullDef = false; - } - // A subreg use of a partially undef (super) register may be a complete // undef use now and then has to be marked that way. if (MO.isUse() && !DstIsPhys) { @@ -1903,25 +1894,6 @@ void RegisterCoalescer::updateRegDefsUses(Register SrcReg, Register DstReg, MO.substVirtReg(DstReg, SubIdx, *TRI); } - if (IsSubregToReg && !FullDef) { - // If the coalesed instruction doesn't fully define the register, we need - // to preserve the original super register liveness for SUBREG_TO_REG. - // - // We pretended SUBREG_TO_REG was a regular copy for coalescing purposes, - // but it introduces liveness for other subregisters. Downstream users may - // have been relying on those bits, so we need to ensure their liveness is - // captured with a def of other lanes. - - // FIXME: Need to add new subrange if tracking subranges. We could also - // skip adding this if we knew the other lanes are dead, and only for - // other lanes. - - assert(!MRI->shouldTrackSubRegLiveness(DstReg) && - "this should update subranges"); - MachineInstrBuilder MIB(*MF, UseMI); - MIB.addReg(DstReg, RegState::ImplicitDefine); - } - LLVM_DEBUG({ dbgs() << "\t\tupdated: "; if (!UseMI->isDebugInstr()) @@ -2121,8 +2093,6 @@ bool RegisterCoalescer::joinCopy(MachineInstr *CopyMI, bool &Again) { }); } - const bool IsSubregToReg = CopyMI->isSubregToReg(); - ShrinkMask = LaneBitmask::getNone(); ShrinkMainRange = false; @@ -2190,12 +2160,9 @@ bool RegisterCoalescer::joinCopy(MachineInstr *CopyMI, bool &Again) { // Rewrite all SrcReg operands to DstReg. // Also update DstReg operands to include DstIdx if it is set. - if (CP.getDstIdx()) { - assert(!IsSubregToReg && "can this happen?"); - updateRegDefsUses(CP.getDstReg(), CP.getDstReg(), CP.getDstIdx(), false); - } - updateRegDefsUses(CP.getSrcReg(), CP.getDstReg(), CP.getSrcIdx(), - IsSubregToReg); + if (CP.getDstIdx()) + updateRegDefsUses(CP.getDstReg(), CP.getDstReg(), CP.getDstIdx()); + updateRegDefsUses(CP.getSrcReg(), CP.getDstReg(), CP.getSrcIdx()); // Shrink subregister ranges if necessary. if (ShrinkMask.any()) {