From: Alexey Samsonov Date: Tue, 27 May 2014 22:35:00 +0000 (+0000) Subject: Don't pre-populate the set of keys in the map with variable locations history. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f0e0cca0c761a9a8593873c67d3d081fa0d07ebe;p=platform%2Fupstream%2Fllvm.git Don't pre-populate the set of keys in the map with variable locations history. Current implementation of calculateDbgValueHistory already creates the keys in the expected order (user variables are listed in order of appearance), and should do so later by contract. No functionality change. llvm-svn: 209690 --- diff --git a/llvm/lib/CodeGen/AsmPrinter/DbgValueHistoryCalculator.cpp b/llvm/lib/CodeGen/AsmPrinter/DbgValueHistoryCalculator.cpp index c9bf1ec..450d154 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DbgValueHistoryCalculator.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DbgValueHistoryCalculator.cpp @@ -144,6 +144,7 @@ void calculateDbgValueHistory(const MachineFunction *MF, continue; } + assert(MI.getNumOperands() > 1 && "Invalid DBG_VALUE instruction!"); const MDNode *Var = MI.getDebugVariable(); auto &History = Result[Var]; diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index 967c7b1..dad44b8 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -1404,17 +1404,8 @@ void DwarfDebug::beginFunction(const MachineFunction *MF) { // Collect user variables, find the end of the prologue. for (const auto &MBB : *MF) { for (const auto &MI : MBB) { - if (MI.isDebugValue()) { - assert(MI.getNumOperands() > 1 && "Invalid machine instruction!"); - // Keep track of user variables in order of appearance. Create the - // empty history for each variable so that the order of keys in - // DbgValues is correct. Actual history will be populated in - // calculateDbgValueHistory() function. - const MDNode *Var = MI.getDebugVariable(); - DbgValues.insert( - std::make_pair(Var, SmallVector())); - } else if (!MI.getFlag(MachineInstr::FrameSetup) && - PrologEndLoc.isUnknown() && !MI.getDebugLoc().isUnknown()) { + if (!MI.isDebugValue() && !MI.getFlag(MachineInstr::FrameSetup) && + PrologEndLoc.isUnknown() && !MI.getDebugLoc().isUnknown()) { // First known non-DBG_VALUE and non-frame setup location marks // the beginning of the function body. PrologEndLoc = MI.getDebugLoc();