From owner-svn-src-all@freebsd.org Mon Aug 17 16:34:11 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7A7563B6A24; Mon, 17 Aug 2020 16:34:11 +0000 (UTC) (envelope-from dim@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 "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BVfkq2bhDz3f2x; Mon, 17 Aug 2020 16:34:11 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3C4A423C07; Mon, 17 Aug 2020 16:34:11 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07HGYBVo094985; Mon, 17 Aug 2020 16:34:11 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07HGYAta094983; Mon, 17 Aug 2020 16:34:10 GMT (envelope-from dim@FreeBSD.org) Message-Id: <202008171634.07HGYAta094983@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Mon, 17 Aug 2020 16:34:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364313 - head/contrib/llvm-project/llvm/lib/Target/PowerPC X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: head/contrib/llvm-project/llvm/lib/Target/PowerPC X-SVN-Commit-Revision: 364313 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Aug 2020 16:34:11 -0000 Author: dim Date: Mon Aug 17 16:34:10 2020 New Revision: 364313 URL: https://svnweb.freebsd.org/changeset/base/364313 Log: Revert r364275, for reapplying the final upstream fix: Tentatively apply https://reviews.llvm.org/D85659, which fixes an assertion failure when building world for powerpc. This has been reported upstream as . Modified: head/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp head/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCInstrInfo.h Modified: head/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp ============================================================================== --- head/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp Mon Aug 17 16:28:59 2020 (r364312) +++ head/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp Mon Aug 17 16:34:10 2020 (r364313) @@ -2653,31 +2653,22 @@ const unsigned *PPCInstrInfo::getLoadOpcodesForSpillAr return LoadSpillOpcodesArray[getSpillTarget()]; } -void PPCInstrInfo::fixupIsDeadOrKill(MachineInstr *StartMI, MachineInstr *EndMI, +void PPCInstrInfo::fixupIsDeadOrKill(MachineInstr &StartMI, MachineInstr &EndMI, unsigned RegNo) const { // Conservatively clear kill flag for the register if the instructions are in // different basic blocks and in SSA form, because the kill flag may no longer // be right. There is no need to bother with dead flags since defs with no // uses will be handled by DCE. - MachineRegisterInfo &MRI = StartMI->getParent()->getParent()->getRegInfo(); - if (MRI.isSSA() && (StartMI->getParent() != EndMI->getParent())) { + MachineRegisterInfo &MRI = StartMI.getParent()->getParent()->getRegInfo(); + if (MRI.isSSA() && (StartMI.getParent() != EndMI.getParent())) { MRI.clearKillFlags(RegNo); return; } // Instructions between [StartMI, EndMI] should be in same basic block. - assert((StartMI->getParent() == EndMI->getParent()) && + assert((StartMI.getParent() == EndMI.getParent()) && "Instructions are not in same basic block"); - // If before RA, StartMI may be def through copy, we need to adjust it to the - // real def. See function getForwardingDefMI. - if (MRI.isSSA() && StartMI->findRegisterUseOperandIdx(RegNo) < 0 && - StartMI->findRegisterDefOperandIdx(RegNo) < 0) { - assert(Register::isVirtualRegister(RegNo) && "Must be a virtual register"); - // Get real def and ignore copies. - StartMI = MRI.getVRegDef(RegNo); - } - bool IsKillSet = false; auto clearOperandKillInfo = [=] (MachineInstr &MI, unsigned Index) { @@ -2690,21 +2681,21 @@ void PPCInstrInfo::fixupIsDeadOrKill(MachineInstr *Sta // Set killed flag for EndMI. // No need to do anything if EndMI defines RegNo. int UseIndex = - EndMI->findRegisterUseOperandIdx(RegNo, false, &getRegisterInfo()); + EndMI.findRegisterUseOperandIdx(RegNo, false, &getRegisterInfo()); if (UseIndex != -1) { - EndMI->getOperand(UseIndex).setIsKill(true); + EndMI.getOperand(UseIndex).setIsKill(true); IsKillSet = true; // Clear killed flag for other EndMI operands related to RegNo. In some // upexpected cases, killed may be set multiple times for same register // operand in same MI. - for (int i = 0, e = EndMI->getNumOperands(); i != e; ++i) + for (int i = 0, e = EndMI.getNumOperands(); i != e; ++i) if (i != UseIndex) - clearOperandKillInfo(*EndMI, i); + clearOperandKillInfo(EndMI, i); } // Walking the inst in reverse order (EndMI -> StartMI]. - MachineBasicBlock::reverse_iterator It = *EndMI; - MachineBasicBlock::reverse_iterator E = EndMI->getParent()->rend(); + MachineBasicBlock::reverse_iterator It = EndMI; + MachineBasicBlock::reverse_iterator E = EndMI.getParent()->rend(); // EndMI has been handled above, skip it here. It++; MachineOperand *MO = nullptr; @@ -2730,13 +2721,13 @@ void PPCInstrInfo::fixupIsDeadOrKill(MachineInstr *Sta } else if ((MO = It->findRegisterDefOperand(RegNo, false, true, &getRegisterInfo()))) { // No use found, set dead for its def. - assert(&*It == StartMI && "No new def between StartMI and EndMI."); + assert(&*It == &StartMI && "No new def between StartMI and EndMI."); MO->setIsDead(true); break; } } - if ((&*It) == StartMI) + if ((&*It) == &StartMI) break; } // Ensure RegMo liveness is killed after EndMI. @@ -3867,7 +3858,7 @@ bool PPCInstrInfo::simplifyToLI(MachineInstr &MI, Mach // ForwardingOperandReg = LI imm1 // y = op2 imm2, ForwardingOperandReg(killed) if (IsForwardingOperandKilled) - fixupIsDeadOrKill(&DefMI, &MI, ForwardingOperandReg); + fixupIsDeadOrKill(DefMI, MI, ForwardingOperandReg); LLVM_DEBUG(dbgs() << "With:\n"); LLVM_DEBUG(MI.dump()); @@ -3959,9 +3950,9 @@ bool PPCInstrInfo::transformToNewImmFormFedByAdd( // Update kill flag if (RegMO->isKill() || IsKilledFor(RegMO->getReg())) - fixupIsDeadOrKill(&DefMI, &MI, RegMO->getReg()); + fixupIsDeadOrKill(DefMI, MI, RegMO->getReg()); if (ForwardKilledOperandReg != ~0U) - fixupIsDeadOrKill(&DefMI, &MI, ForwardKilledOperandReg); + fixupIsDeadOrKill(DefMI, MI, ForwardKilledOperandReg); } LLVM_DEBUG(dbgs() << "With:\n"); @@ -4072,12 +4063,12 @@ bool PPCInstrInfo::transformToImmFormFedByAdd( // x = ADD reg(killed), imm // y = XOP 0, x if (IsFwdFeederRegKilled || RegMO->isKill()) - fixupIsDeadOrKill(&DefMI, &MI, RegMO->getReg()); + fixupIsDeadOrKill(DefMI, MI, RegMO->getReg()); // Pattern 3: // ForwardKilledOperandReg = ADD reg, imm // y = XOP 0, ForwardKilledOperandReg(killed) if (ForwardKilledOperandReg != ~0U) - fixupIsDeadOrKill(&DefMI, &MI, ForwardKilledOperandReg); + fixupIsDeadOrKill(DefMI, MI, ForwardKilledOperandReg); LLVM_DEBUG(dbgs() << "With:\n"); LLVM_DEBUG(MI.dump()); @@ -4233,7 +4224,7 @@ bool PPCInstrInfo::transformToImmFormFedByLI(MachineIn // ForwardKilledOperandReg = LI imm // y = XOP reg, ForwardKilledOperandReg(killed) if (ForwardKilledOperandReg != ~0U) - fixupIsDeadOrKill(&DefMI, &MI, ForwardKilledOperandReg); + fixupIsDeadOrKill(DefMI, MI, ForwardKilledOperandReg); return true; } Modified: head/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCInstrInfo.h ============================================================================== --- head/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCInstrInfo.h Mon Aug 17 16:28:59 2020 (r364312) +++ head/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCInstrInfo.h Mon Aug 17 16:34:10 2020 (r364313) @@ -577,7 +577,7 @@ class PPCInstrInfo : public PPCGenInstrInfo { (public) /// we conservatively clear kill flag for all uses of \p RegNo for pre-RA /// and for post-RA, we give an assertion as without reaching definition /// analysis post-RA, \p StartMI and \p EndMI are hard to keep right. - void fixupIsDeadOrKill(MachineInstr *StartMI, MachineInstr *EndMI, + void fixupIsDeadOrKill(MachineInstr &StartMI, MachineInstr &EndMI, unsigned RegNo) const; void replaceInstrWithLI(MachineInstr &MI, const LoadImmediateInfo &LII) const; void replaceInstrOperandWithImm(MachineInstr &MI, unsigned OpNo,