diff options
author | Matt Arsenault <Matthew.Arsenault@amd.com> | 2019-09-11 17:59:21 +0000 |
---|---|---|
committer | Matt Arsenault <Matthew.Arsenault@amd.com> | 2019-09-11 17:59:21 +0000 |
commit | 81196a595c681633bd381b56cf40119bb6d2327b (patch) | |
tree | 77b3c6df2455f54ba63a8ecdd819b731ef818c4a /llvm/lib/CodeGen/LiveIntervals.cpp | |
parent | b51d5605b1817fdce33c5f30316b0b5a5aef5116 (diff) | |
download | bcm5719-llvm-81196a595c681633bd381b56cf40119bb6d2327b.tar.gz bcm5719-llvm-81196a595c681633bd381b56cf40119bb6d2327b.zip |
LiveIntervals: Split live intervals on multiple dead defs
If there are multiple dead defs of the same virtual register, these
are required to be split into multiple virtual registers with separate
live intervals to avoid a verifier error.
llvm-svn: 371640
Diffstat (limited to 'llvm/lib/CodeGen/LiveIntervals.cpp')
-rw-r--r-- | llvm/lib/CodeGen/LiveIntervals.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/LiveIntervals.cpp b/llvm/lib/CodeGen/LiveIntervals.cpp index 0781a0b121b..2d5b8e79910 100644 --- a/llvm/lib/CodeGen/LiveIntervals.cpp +++ b/llvm/lib/CodeGen/LiveIntervals.cpp @@ -196,7 +196,11 @@ void LiveIntervals::computeVirtRegInterval(LiveInterval &LI) { assert(LI.empty() && "Should only compute empty intervals."); LRCalc->reset(MF, getSlotIndexes(), DomTree, &getVNInfoAllocator()); LRCalc->calculate(LI, MRI->shouldTrackSubRegLiveness(LI.reg)); - computeDeadValues(LI, nullptr); + + if (computeDeadValues(LI, nullptr)) { + SmallVector<LiveInterval *, 4> SplitIntervals; + splitSeparateComponents(LI, SplitIntervals); + } } void LiveIntervals::computeVirtRegs() { @@ -500,6 +504,8 @@ bool LiveIntervals::shrinkToUses(LiveInterval *li, bool LiveIntervals::computeDeadValues(LiveInterval &LI, SmallVectorImpl<MachineInstr*> *dead) { bool MayHaveSplitComponents = false; + bool HaveDeadDef = false; + for (VNInfo *VNI : LI.valnos) { if (VNI->isUnused()) continue; @@ -530,6 +536,10 @@ bool LiveIntervals::computeDeadValues(LiveInterval &LI, MachineInstr *MI = getInstructionFromIndex(Def); assert(MI && "No instruction defining live value"); MI->addRegisterDead(LI.reg, TRI); + if (HaveDeadDef) + MayHaveSplitComponents = true; + HaveDeadDef = true; + if (dead && MI->allDefsAreDead()) { LLVM_DEBUG(dbgs() << "All defs dead: " << Def << '\t' << *MI); dead->push_back(MI); |