diff options
author | Matt Arsenault <Matthew.Arsenault@amd.com> | 2023-07-28 13:05:22 -0400 |
---|---|---|
committer | Matt Arsenault <Matthew.Arsenault@amd.com> | 2023-07-31 20:15:45 -0400 |
commit | 4d42e8b5d1fa87e49768d100dd1bc53515391e89 (patch) | |
tree | 5e90752ff661e06bb3463705febdb56184cd0b99 /llvm/lib/CodeGen/SplitKit.cpp | |
parent | 04af7d224bd8ee2b346525b02ed04f57d8d9d1f8 (diff) | |
download | llvm-4d42e8b5d1fa87e49768d100dd1bc53515391e89.zip llvm-4d42e8b5d1fa87e49768d100dd1bc53515391e89.tar.gz llvm-4d42e8b5d1fa87e49768d100dd1bc53515391e89.tar.bz2 |
Reapply "[CodeGen]Allow targets to use target specific COPY instructions for live range splitting"
This reverts commit a496c8be6e638ae58bb45f13113dbe3a4b7b23fd.
The workaround in c26dfc81e254c78dc23579cf3d1336f77249e1f6 should work
around the underlying problem with SUBREG_TO_REG.
Diffstat (limited to 'llvm/lib/CodeGen/SplitKit.cpp')
-rw-r--r-- | llvm/lib/CodeGen/SplitKit.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/llvm/lib/CodeGen/SplitKit.cpp b/llvm/lib/CodeGen/SplitKit.cpp index eee54f0..83964ec 100644 --- a/llvm/lib/CodeGen/SplitKit.cpp +++ b/llvm/lib/CodeGen/SplitKit.cpp @@ -514,10 +514,10 @@ void SplitEditor::forceRecompute(unsigned RegIdx, const VNInfo &ParentVNI) { VFP = ValueForcePair(nullptr, true); } -SlotIndex SplitEditor::buildSingleSubRegCopy(Register FromReg, Register ToReg, - MachineBasicBlock &MBB, MachineBasicBlock::iterator InsertBefore, - unsigned SubIdx, LiveInterval &DestLI, bool Late, SlotIndex Def) { - const MCInstrDesc &Desc = TII.get(TargetOpcode::COPY); +SlotIndex SplitEditor::buildSingleSubRegCopy( + Register FromReg, Register ToReg, MachineBasicBlock &MBB, + MachineBasicBlock::iterator InsertBefore, unsigned SubIdx, + LiveInterval &DestLI, bool Late, SlotIndex Def, const MCInstrDesc &Desc) { bool FirstCopy = !Def.isValid(); MachineInstr *CopyMI = BuildMI(MBB, InsertBefore, DebugLoc(), Desc) .addReg(ToReg, RegState::Define | getUndefRegState(FirstCopy) @@ -536,7 +536,8 @@ SlotIndex SplitEditor::buildSingleSubRegCopy(Register FromReg, Register ToReg, SlotIndex SplitEditor::buildCopy(Register FromReg, Register ToReg, LaneBitmask LaneMask, MachineBasicBlock &MBB, MachineBasicBlock::iterator InsertBefore, bool Late, unsigned RegIdx) { - const MCInstrDesc &Desc = TII.get(TargetOpcode::COPY); + const MCInstrDesc &Desc = + TII.get(TII.getLiveRangeSplitOpcode(FromReg, *MBB.getParent())); SlotIndexes &Indexes = *LIS.getSlotIndexes(); if (LaneMask.all() || LaneMask == MRI.getMaxLaneMaskForVReg(FromReg)) { // The full vreg is copied. @@ -564,7 +565,7 @@ SlotIndex SplitEditor::buildCopy(Register FromReg, Register ToReg, SlotIndex Def; for (unsigned BestIdx : SubIndexes) { Def = buildSingleSubRegCopy(FromReg, ToReg, MBB, InsertBefore, BestIdx, - DestLI, Late, Def); + DestLI, Late, Def, Desc); } BumpPtrAllocator &Allocator = LIS.getVNInfoAllocator(); @@ -1584,7 +1585,9 @@ bool SplitAnalysis::shouldSplitSingleBlock(const BlockInfo &BI, if (BI.LiveIn && BI.LiveOut) return true; // No point in isolating a copy. It has no register class constraints. - if (LIS.getInstructionFromIndex(BI.FirstInstr)->isCopyLike()) + MachineInstr *MI = LIS.getInstructionFromIndex(BI.FirstInstr); + bool copyLike = TII.isCopyInstr(*MI) || MI->isSubregToReg(); + if (copyLike) return false; // Finally, don't isolate an end point that was created by earlier splits. return isOriginalEndpoint(BI.FirstInstr); |