diff options
author | Jay Foad <jay.foad@amd.com> | 2020-09-28 09:30:58 +0100 |
---|---|---|
committer | Jay Foad <jay.foad@amd.com> | 2020-09-30 10:16:25 +0100 |
commit | cdac4492b4a523a888a013d42ea0a968f684ed59 (patch) | |
tree | 70cd256b141378c25fe1ee37febbccb7d3ca79ba /llvm/lib/CodeGen/SplitKit.cpp | |
parent | 0249df33fec16b728e2d33cae02f5da4c9f74e38 (diff) | |
download | llvm-cdac4492b4a523a888a013d42ea0a968f684ed59.zip llvm-cdac4492b4a523a888a013d42ea0a968f684ed59.tar.gz llvm-cdac4492b4a523a888a013d42ea0a968f684ed59.tar.bz2 |
[SplitKit] Cope with no live subranges in defFromParent
Following on from D87757 "[SplitKit] Only copy live lanes", it is
possible to split a live range at a point when none of its subranges
are live. This patch handles that case by inserting an implicit def
of the superreg.
Patch by Quentin Colombet!
Differential Revision: https://reviews.llvm.org/D88397
Diffstat (limited to 'llvm/lib/CodeGen/SplitKit.cpp')
-rw-r--r-- | llvm/lib/CodeGen/SplitKit.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/SplitKit.cpp b/llvm/lib/CodeGen/SplitKit.cpp index f62aa8d..9e7d6d2 100644 --- a/llvm/lib/CodeGen/SplitKit.cpp +++ b/llvm/lib/CodeGen/SplitKit.cpp @@ -663,13 +663,19 @@ VNInfo *SplitEditor::defFromParent(unsigned RegIdx, if (S.liveAt(UseIdx)) LaneMask |= S.LaneMask; } - assert(LaneMask.any() && "Interval has no live subranges"); } else { LaneMask = LaneBitmask::getAll(); } - ++NumCopies; - Def = buildCopy(Edit->getReg(), Reg, LaneMask, MBB, I, Late, RegIdx); + if (LaneMask.none()) { + const MCInstrDesc &Desc = TII.get(TargetOpcode::IMPLICIT_DEF); + MachineInstr *ImplicitDef = BuildMI(MBB, I, DebugLoc(), Desc, Reg); + SlotIndexes &Indexes = *LIS.getSlotIndexes(); + Def = Indexes.insertMachineInstrInMaps(*ImplicitDef, Late).getRegSlot(); + } else { + ++NumCopies; + Def = buildCopy(Edit->getReg(), Reg, LaneMask, MBB, I, Late, RegIdx); + } } // Define the value in Reg. |