diff options
| author | Krzysztof Parzyszek <kparzysz@quicinc.com> | 2019-10-30 08:21:27 -0500 |
|---|---|---|
| committer | Krzysztof Parzyszek <kparzysz@quicinc.com> | 2019-10-30 08:50:46 -0500 |
| commit | 43144ffa91a2c250cab453b6abd2d1913db3e4d4 (patch) | |
| tree | 91883e169b8f493c9544e734a531a3bed4c45435 /llvm/lib | |
| parent | 83a55c6a575806eec78062dfe128c095c26ab5e2 (diff) | |
| download | bcm5719-llvm-43144ffa91a2c250cab453b6abd2d1913db3e4d4.tar.gz bcm5719-llvm-43144ffa91a2c250cab453b6abd2d1913db3e4d4.zip | |
LiveIntervals: Split live intervals on multiple dead defs
This is a follow-up to D67448.
Split live intervals with multiple dead defs during the initial
execution of the live interval analysis, but do it outside of the
function createAndComputeVirtRegInterval.
Differential Revision: https://reviews.llvm.org/D68666
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/CodeGen/LiveIntervals.cpp | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/LiveIntervals.cpp b/llvm/lib/CodeGen/LiveIntervals.cpp index 2989930ad09..600e7880c70 100644 --- a/llvm/lib/CodeGen/LiveIntervals.cpp +++ b/llvm/lib/CodeGen/LiveIntervals.cpp @@ -191,12 +191,12 @@ LiveInterval* LiveIntervals::createInterval(unsigned reg) { } /// Compute the live interval of a virtual register, based on defs and uses. -void LiveIntervals::computeVirtRegInterval(LiveInterval &LI) { +bool LiveIntervals::computeVirtRegInterval(LiveInterval &LI) { assert(LRCalc && "LRCalc not initialized."); assert(LI.empty() && "Should only compute empty intervals."); LRCalc->reset(MF, getSlotIndexes(), DomTree, &getVNInfoAllocator()); LRCalc->calculate(LI, MRI->shouldTrackSubRegLiveness(LI.reg)); - computeDeadValues(LI, nullptr); + return computeDeadValues(LI, nullptr); } void LiveIntervals::computeVirtRegs() { @@ -204,7 +204,12 @@ void LiveIntervals::computeVirtRegs() { unsigned Reg = Register::index2VirtReg(i); if (MRI->reg_nodbg_empty(Reg)) continue; - createAndComputeVirtRegInterval(Reg); + LiveInterval &LI = createEmptyInterval(Reg); + bool NeedSplit = computeVirtRegInterval(LI); + if (NeedSplit) { + SmallVector<LiveInterval*, 8> SplitLIs; + splitSeparateComponents(LI, SplitLIs); + } } } @@ -500,6 +505,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 +537,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); |

