From: Devang Patel Date: Wed, 26 May 2010 17:29:32 +0000 (+0000) Subject: Do not construct location list backword! X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=e2df84254d628db835eb3e6456187cc3c0085a07;p=oota-llvm.git Do not construct location list backword! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104705 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index afa0fa16bd2..231f63c1bc5 100644 --- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -2215,22 +2215,26 @@ void DwarfDebug::collectVariableInfo(const MachineFunction *MF) { RegVar->setDotDebugLocOffset(DotDebugLocEntries.size()); if (DotDebugLocEntries.empty()) DotDebugLocEntries.push_back(DotDebugLocEntry()); - const MachineInstr *Current = MultipleValues.back(); - MultipleValues.pop_back(); - while (!MultipleValues.empty()) { - const MachineInstr *Next = MultipleValues.back(); - MultipleValues.pop_back(); - DbgValueStartMap[Next] = RegVar; + const MachineInstr *Begin = NULL; + const MachineInstr *End = NULL; + for (SmallVector::iterator + MVI = MultipleValues.begin(), MVE = MultipleValues.end(); MVI != MVE; ++MVI) { + if (!Begin) { + Begin = *MVI; + continue; + } + End = *MVI; + DbgValueStartMap[End] = RegVar; MachineLocation MLoc; - MLoc.set(Current->getOperand(0).getReg(), 0); - const MCSymbol *FLabel = getLabelBeforeInsn(Next); - const MCSymbol *SLabel = getLabelBeforeInsn(Current); + MLoc.set(Begin->getOperand(0).getReg(), 0); + const MCSymbol *FLabel = getLabelBeforeInsn(Begin); + const MCSymbol *SLabel = getLabelBeforeInsn(End); DotDebugLocEntries.push_back(DotDebugLocEntry(FLabel, SLabel, MLoc)); - Current = Next; - if (MultipleValues.empty()) { - // If Next is the last instruction then its value is valid + Begin = End; + if (MVI + 1 == MVE) { + // If End is the last instruction then its value is valid // until the end of the funtion. - MLoc.set(Next->getOperand(0).getReg(), 0); + MLoc.set(End->getOperand(0).getReg(), 0); DotDebugLocEntries. push_back(DotDebugLocEntry(SLabel, FunctionEndSym, MLoc)); }