From bd265c3ec6fc867cd7d934ed069adcd259b923e9 Mon Sep 17 00:00:00 2001 From: Matthias Braun Date: Fri, 26 May 2017 01:29:32 +0000 Subject: [PATCH] Revert "LivePhysRegs: Skip reserved regs in computeLiveIns; NFCI" Tentatively revert, suspecting that it caused breakage in stage2 buildbots. This reverts commit r303949. This reverts commit r303937. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303955 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/CodeGen/LivePhysRegs.h | 2 +- lib/CodeGen/BranchFolding.cpp | 7 +++---- lib/CodeGen/BranchFolding.h | 1 - lib/CodeGen/BranchRelaxation.cpp | 2 +- lib/CodeGen/LivePhysRegs.cpp | 8 ++------ 5 files changed, 7 insertions(+), 13 deletions(-) diff --git a/include/llvm/CodeGen/LivePhysRegs.h b/include/llvm/CodeGen/LivePhysRegs.h index fede6a856f9..cde9096d750 100644 --- a/include/llvm/CodeGen/LivePhysRegs.h +++ b/include/llvm/CodeGen/LivePhysRegs.h @@ -163,7 +163,7 @@ inline raw_ostream &operator<<(raw_ostream &OS, const LivePhysRegs& LR) { /// lists are up-to-date. Uses the given LivePhysReg instance \p LiveRegs; This /// is just here to avoid repeated heap allocations when calling this multiple /// times in a pass. -void computeLiveIns(LivePhysRegs &LiveRegs, const MachineRegisterInfo &MRI, +void computeLiveIns(LivePhysRegs &LiveRegs, const TargetRegisterInfo &TRI, MachineBasicBlock &MBB); } // end namespace llvm diff --git a/lib/CodeGen/BranchFolding.cpp b/lib/CodeGen/BranchFolding.cpp index 03ceac10bee..025b9fc6cd0 100644 --- a/lib/CodeGen/BranchFolding.cpp +++ b/lib/CodeGen/BranchFolding.cpp @@ -153,14 +153,13 @@ bool BranchFolder::OptimizeFunction(MachineFunction &MF, TriedMerging.clear(); - MachineRegisterInfo &MRI = MF.getRegInfo(); AfterBlockPlacement = AfterPlacement; TII = tii; TRI = tri; MMI = mmi; MLI = mli; - this->MRI = &MRI; + MachineRegisterInfo &MRI = MF.getRegInfo(); UpdateLiveIns = MRI.tracksLiveness() && TRI->trackLivenessAfterRegAlloc(MF); if (!UpdateLiveIns) MRI.invalidateLiveness(); @@ -352,7 +351,7 @@ void BranchFolder::ReplaceTailWithBranchTo(MachineBasicBlock::iterator OldInst, if (UpdateLiveIns) { NewDest->clearLiveIns(); - computeLiveIns(LiveRegs, *MRI, *NewDest); + computeLiveIns(LiveRegs, *TRI, *NewDest); } ++NumTailMerge; @@ -389,7 +388,7 @@ MachineBasicBlock *BranchFolder::SplitMBBAt(MachineBasicBlock &CurMBB, MBBFreqInfo.setBlockFreq(NewMBB, MBBFreqInfo.getBlockFreq(&CurMBB)); if (UpdateLiveIns) - computeLiveIns(LiveRegs, *MRI, *NewMBB); + computeLiveIns(LiveRegs, *TRI, *NewMBB); // Add the new block to the funclet. const auto &FuncletI = FuncletMembership.find(&CurMBB); diff --git a/lib/CodeGen/BranchFolding.h b/lib/CodeGen/BranchFolding.h index 92681137e4c..4852721eea1 100644 --- a/lib/CodeGen/BranchFolding.h +++ b/lib/CodeGen/BranchFolding.h @@ -108,7 +108,6 @@ namespace llvm { bool UpdateLiveIns; unsigned MinCommonTailLength; const TargetInstrInfo *TII; - const MachineRegisterInfo *MRI; const TargetRegisterInfo *TRI; MachineModuleInfo *MMI; MachineLoopInfo *MLI; diff --git a/lib/CodeGen/BranchRelaxation.cpp b/lib/CodeGen/BranchRelaxation.cpp index feaabb44c07..7af13694166 100644 --- a/lib/CodeGen/BranchRelaxation.cpp +++ b/lib/CodeGen/BranchRelaxation.cpp @@ -259,7 +259,7 @@ MachineBasicBlock *BranchRelaxation::splitBlockBeforeInstr(MachineInstr &MI, // Need to fix live-in lists if we track liveness. if (TRI->trackLivenessAfterRegAlloc(*MF)) - computeLiveIns(LiveRegs, MF->getRegInfo(), *NewBB); + computeLiveIns(LiveRegs, *TRI, *NewBB); ++NumSplit; diff --git a/lib/CodeGen/LivePhysRegs.cpp b/lib/CodeGen/LivePhysRegs.cpp index 774fa4c8c3e..d90e8930598 100644 --- a/lib/CodeGen/LivePhysRegs.cpp +++ b/lib/CodeGen/LivePhysRegs.cpp @@ -214,10 +214,8 @@ void LivePhysRegs::addLiveIns(const MachineBasicBlock &MBB) { addBlockLiveIns(MBB); } -void llvm::computeLiveIns(LivePhysRegs &LiveRegs, - const MachineRegisterInfo &MRI, +void llvm::computeLiveIns(LivePhysRegs &LiveRegs, const TargetRegisterInfo &TRI, MachineBasicBlock &MBB) { - const TargetRegisterInfo &TRI = *MRI.getTargetRegisterInfo(); assert(MBB.livein_empty()); LiveRegs.init(TRI); LiveRegs.addLiveOutsNoPristines(MBB); @@ -225,12 +223,10 @@ void llvm::computeLiveIns(LivePhysRegs &LiveRegs, LiveRegs.stepBackward(MI); for (unsigned Reg : LiveRegs) { - if (MRI.isReserved(Reg)) - continue; // Skip the register if we are about to add one of its super registers. bool ContainsSuperReg = false; for (MCSuperRegIterator SReg(Reg, &TRI); SReg.isValid(); ++SReg) { - if (LiveRegs.contains(*SReg) && !MRI.isReserved(*SReg)) { + if (LiveRegs.contains(*SReg)) { ContainsSuperReg = true; break; } -- 2.40.0