From 5c13598fd7032bd27b5ee1c86fe8698d22594360 Mon Sep 17 00:00:00 2001 From: Jakob Stoklund Olesen Date: Wed, 9 Feb 2011 21:52:09 +0000 Subject: [PATCH] Ignore uses when analyzing and rewriting. llvm-svn: 125226 --- lib/CodeGen/SplitKit.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/lib/CodeGen/SplitKit.cpp b/lib/CodeGen/SplitKit.cpp index e26d909211c..2f36f163f62 100644 --- a/lib/CodeGen/SplitKit.cpp +++ b/lib/CodeGen/SplitKit.cpp @@ -64,8 +64,12 @@ bool SplitAnalysis::canAnalyzeBranch(const MachineBasicBlock *MBB) { /// analyzeUses - Count instructions, basic blocks, and loops using CurLI. void SplitAnalysis::analyzeUses() { const MachineRegisterInfo &MRI = MF.getRegInfo(); - for (MachineRegisterInfo::reg_iterator I = MRI.reg_begin(CurLI->reg); - MachineInstr *MI = I.skipInstruction();) { + for (MachineRegisterInfo::reg_iterator I = MRI.reg_begin(CurLI->reg), + E = MRI.reg_end(); I != E; ++I) { + MachineOperand &MO = I.getOperand(); + if (MO.isUse() && MO.isUndef()) + continue; + MachineInstr *MI = MO.getParent(); if (MI->isDebugValue() || !UsingInstrs.insert(MI)) continue; UseSlots.push_back(LIS.getInstructionIndex(MI).getDefIndex()); @@ -918,6 +922,14 @@ void SplitEditor::rewriteAssigned() { MO.setReg(0); continue; } + + // operands don't really read the register, so just assign them to + // the complement. + if (MO.isUse() && MO.isUndef()) { + MO.setReg(Edit.get(0)->reg); + continue; + } + SlotIndex Idx = LIS.getInstructionIndex(MI); Idx = MO.isUse() ? Idx.getUseIndex() : Idx.getDefIndex();