diff options
author | Jay Foad <jay.foad@amd.com> | 2021-11-04 13:43:09 +0000 |
---|---|---|
committer | Jay Foad <jay.foad@amd.com> | 2021-11-05 21:20:30 +0000 |
commit | bdaa181007a46d317a1665acb8234eddeee82815 (patch) | |
tree | f2382429fc7c6a4113c72468bd0c9b9ec3744b57 /llvm/lib/CodeGen/TwoAddressInstructionPass.cpp | |
parent | 7a189fb2678c5a690cda5c0bb75efa70edf2e384 (diff) | |
download | llvm-bdaa181007a46d317a1665acb8234eddeee82815.zip llvm-bdaa181007a46d317a1665acb8234eddeee82815.tar.gz llvm-bdaa181007a46d317a1665acb8234eddeee82815.tar.bz2 |
[TwoAddressInstructionPass] Update existing physreg live intervals
In TwoAddressInstructionPass::processTiedPairs with
-early-live-intervals, update any preexisting physreg live intervals,
as well as virtreg live intervals. By default (without
-precompute-phys-liveness) physreg live intervals only exist for
registers that are live-in to some basic block.
Differential Revision: https://reviews.llvm.org/D113191
Diffstat (limited to 'llvm/lib/CodeGen/TwoAddressInstructionPass.cpp')
-rw-r--r-- | llvm/lib/CodeGen/TwoAddressInstructionPass.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp b/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp index fdd2bc6..ca7d7e9 100644 --- a/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp +++ b/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp @@ -1539,15 +1539,23 @@ TwoAddressInstructionPass::processTiedPairs(MachineInstr *MI, if (LIS) { LastCopyIdx = LIS->InsertMachineInstrInMaps(*PrevMI).getRegSlot(); + SlotIndex endIdx = + LIS->getInstructionIndex(*MI).getRegSlot(IsEarlyClobber); if (RegA.isVirtual()) { LiveInterval &LI = LIS->getInterval(RegA); VNInfo *VNI = LI.getNextValue(LastCopyIdx, LIS->getVNInfoAllocator()); - SlotIndex endIdx = - LIS->getInstructionIndex(*MI).getRegSlot(IsEarlyClobber); - LI.addSegment(LiveInterval::Segment(LastCopyIdx, endIdx, VNI)); + LI.addSegment(LiveRange::Segment(LastCopyIdx, endIdx, VNI)); for (auto &S : LI.subranges()) { VNI = S.getNextValue(LastCopyIdx, LIS->getVNInfoAllocator()); - S.addSegment(LiveInterval::Segment(LastCopyIdx, endIdx, VNI)); + S.addSegment(LiveRange::Segment(LastCopyIdx, endIdx, VNI)); + } + } else { + for (MCRegUnitIterator Unit(RegA, TRI); Unit.isValid(); ++Unit) { + if (LiveRange *LR = LIS->getCachedRegUnit(*Unit)) { + VNInfo *VNI = + LR->getNextValue(LastCopyIdx, LIS->getVNInfoAllocator()); + LR->addSegment(LiveRange::Segment(LastCopyIdx, endIdx, VNI)); + } } } } |