From nobody Sat Apr 20 10:34:18 2024 X-Original-To: dev-commits-src-all@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 4VM7DC4kzDz5HWNY; Sat, 20 Apr 2024 10:34:19 +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 4VM7DB3Dlwz4SZ6; Sat, 20 Apr 2024 10:34:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1713609258; 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=YXWLNksSoWBKl9Jdo0Fkj9iV/sAG8sEX+0Ct2qJ8CHk=; b=bzQLPcmOnvhBOmZX7oBH+jKfHT08+QSj9tMKNLaDUAm6NQAFbPhbzkyQgVjFxlxnO8aX4F 8K7S1GXJdzpwMKvz4eSz78GfvfFFXO/VM/1XpjW+quzuaSWvR0AMnWFzWmD8YLsvhOl/Wt GB89momZFlKZYlBvWJXd174bWLRwtEL4FEV9GD3cBjJHX2XecVC7alIHSx5ghZEE9tkCBw i4PO+jsYpZO9ZnrR1KZB1PcPsY66KFHSS8Z5RNkxQQMJZXYGWpBG3uWBp0yL/5dpWT4t8H Yc3xy5/9Q4Y9cLXaVARxMQK/zoXtPCYlT0lTbRbdfDrhct/CvutVBucyayQ/0w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1713609258; a=rsa-sha256; cv=none; b=IZKseHcIPz6vCsFMiyQGnJedwxIx23AIrPAnlJm9NSgjvjsITJeIaHUIWC8zAST6zfF7qy iu/0r1E1su75ZlzGUlvNNozyEYbyVeX5AVyUwGu61VKBt7lNh0gL9RM9zngOzhjcsCght6 CjW4MVRNh41rT8Ik1xal1rNkvD6QMaQ1Uu+zPe0shlSgNsfr+/NLtEoopb/q0nEV6Az2AQ yRZXsFoe3z3AilWKdX10dyQkJBvIlwjomRge0ID8jZ0YVqT4s0xSYxjYW5vu7FZotuoo3k nhcKdjXFE5x/vw77OKf8o6YgWFi0MT5/3WtrcS2No6jIscUw9qtkOjC8dl/I/Q== 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=1713609258; 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=YXWLNksSoWBKl9Jdo0Fkj9iV/sAG8sEX+0Ct2qJ8CHk=; b=efyNnQZ1F1EJyjS9qRZgMbIJo8LiV2piepvaPe09cwvgbKmAR59nAW1vLXYzDD1ZFXcDtg UlYr3rBpIMncDwDwlWN/FIQDVDcSojiEjYyrS59UN7e/99rtjA6ozPSK3FUQkPjwJPggiI ST8Ic0T+er8aqYql1Bj0zdSByK+nXH1t5xLUg1ixBCuZywV4aPYNEB/+sY7B5H+sqKShSJ V4B+reTNh0TatohWwP8rAPYGeqjMJDbxP24yYDznBjk38QGmDQZbTnwUYCs6tqCPwTIRl5 v7/gzzgBgghsb7jPn1pKIvWIXxbhTymH5RWaDmt2hwfOj+9rcLnis32cR3uKQQ== 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 4VM7DB2ShWzZJC; Sat, 20 Apr 2024 10:34:18 +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 43KAYISS013332; Sat, 20 Apr 2024 10:34:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 43KAYILV013329; Sat, 20 Apr 2024 10:34:18 GMT (envelope-from git) Date: Sat, 20 Apr 2024 10:34:18 GMT Message-Id: <202404201034.43KAYILV013329@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: 92d4d6f1f60e - stable/13 - Revert commit 0e46b49de433 from llvm-project (by Matt Arsenault): List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@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/13 X-Git-Reftype: branch X-Git-Commit: 92d4d6f1f60e5d9cb2c7e0dd5d632987e54741e8 Auto-Submitted: auto-generated The branch stable/13 has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=92d4d6f1f60e5d9cb2c7e0dd5d632987e54741e8 commit 92d4d6f1f60e5d9cb2c7e0dd5d632987e54741e8 Author: Dimitry Andric AuthorDate: 2024-01-02 16:07:31 +0000 Commit: Dimitry Andric CommitDate: 2024-04-19 21:23:59 +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()) {