<div dir="ltr">When reverting a patch, it helps to include an explanation for why the patch was reverted (as well as a link to any buildbot results, etc). That way those following along or looking back on the patch sequence can have that context.</div><br><div class="gmail_quote"><div dir="ltr">On Mon, Jul 23, 2018 at 11:17 PM Shiva Chen via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: shiva<br>
Date: Mon Jul 23 23:17:45 2018<br>
New Revision: 337812<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=337812&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=337812&view=rev</a><br>
Log:<br>
Revert "[DebugInfo] Generate DWARF debug information for labels."<br>
<br>
This reverts commit b454fa1b4079b6c0a5b1565982d16516385838d7.<br>
<br>
Added:<br>
    llvm/trunk/lib/CodeGen/AsmPrinter/DbgValueHistoryCalculator.cpp<br>
      - copied, changed from r337806, llvm/trunk/lib/CodeGen/AsmPrinter/DbgEntityHistoryCalculator.cpp<br>
    llvm/trunk/lib/CodeGen/AsmPrinter/DbgValueHistoryCalculator.h<br>
      - copied, changed from r337806, llvm/trunk/lib/CodeGen/AsmPrinter/DbgEntityHistoryCalculator.h<br>
Removed:<br>
    llvm/trunk/lib/CodeGen/AsmPrinter/DbgEntityHistoryCalculator.cpp<br>
    llvm/trunk/lib/CodeGen/AsmPrinter/DbgEntityHistoryCalculator.h<br>
    llvm/trunk/test/DebugInfo/Generic/debug-label-inline.ll<br>
    llvm/trunk/test/DebugInfo/Generic/debug-label.ll<br>
Modified:<br>
    llvm/trunk/include/llvm/IR/InstVisitor.h<br>
    llvm/trunk/include/llvm/IR/IntrinsicInst.h<br>
    llvm/trunk/lib/CodeGen/AsmPrinter/CMakeLists.txt<br>
    llvm/trunk/lib/CodeGen/AsmPrinter/CodeViewDebug.h<br>
    llvm/trunk/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp<br>
    llvm/trunk/lib/CodeGen/AsmPrinter/DebugHandlerBase.h<br>
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp<br>
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h<br>
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp<br>
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h<br>
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfFile.cpp<br>
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfFile.h<br>
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp<br>
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h<br>
<br>
Modified: llvm/trunk/include/llvm/IR/InstVisitor.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/InstVisitor.h?rev=337812&r1=337811&r2=337812&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/InstVisitor.h?rev=337812&r1=337811&r2=337812&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/include/llvm/IR/InstVisitor.h (original)<br>
+++ llvm/trunk/include/llvm/IR/InstVisitor.h Mon Jul 23 23:17:45 2018<br>
@@ -213,7 +213,7 @@ public:<br>
   // Handle the special instrinsic instruction classes.<br>
   RetTy visitDbgDeclareInst(DbgDeclareInst &I)    { DELEGATE(DbgInfoIntrinsic);}<br>
   RetTy visitDbgValueInst(DbgValueInst &I)        { DELEGATE(DbgInfoIntrinsic);}<br>
-  RetTy visitDbgLabelInst(DbgLabelInst &I)        { DELEGATE(IntrinsicInst);}<br>
+  RetTy visitDbgLabelInst(DbgLabelInst &I)        { DELEGATE(DbgInfoIntrinsic);}<br>
   RetTy visitDbgInfoIntrinsic(DbgInfoIntrinsic &I) { DELEGATE(IntrinsicInst); }<br>
   RetTy visitMemSetInst(MemSetInst &I)            { DELEGATE(MemIntrinsic); }<br>
   RetTy visitMemCpyInst(MemCpyInst &I)            { DELEGATE(MemTransferInst); }<br>
<br>
Modified: llvm/trunk/include/llvm/IR/IntrinsicInst.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/IntrinsicInst.h?rev=337812&r1=337811&r2=337812&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/IntrinsicInst.h?rev=337812&r1=337811&r2=337812&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/include/llvm/IR/IntrinsicInst.h (original)<br>
+++ llvm/trunk/include/llvm/IR/IntrinsicInst.h Mon Jul 23 23:17:45 2018<br>
@@ -104,6 +104,7 @@ namespace llvm {<br>
       case Intrinsic::dbg_declare:<br>
       case Intrinsic::dbg_value:<br>
       case Intrinsic::dbg_addr:<br>
+      case Intrinsic::dbg_label:<br>
         return true;<br>
       default: return false;<br>
       }<br>
@@ -164,7 +165,7 @@ namespace llvm {<br>
   };<br>
<br>
   /// This represents the llvm.dbg.label instruction.<br>
-  class DbgLabelInst : public IntrinsicInst {<br>
+  class DbgLabelInst : public DbgInfoIntrinsic {<br>
   public:<br>
     DILabel *getLabel() const {<br>
       return cast<DILabel>(getRawVariable());<br>
<br>
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/CMakeLists.txt<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/CMakeLists.txt?rev=337812&r1=337811&r2=337812&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/CMakeLists.txt?rev=337812&r1=337811&r2=337812&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/CodeGen/AsmPrinter/CMakeLists.txt (original)<br>
+++ llvm/trunk/lib/CodeGen/AsmPrinter/CMakeLists.txt Mon Jul 23 23:17:45 2018<br>
@@ -5,7 +5,7 @@ add_llvm_library(LLVMAsmPrinter<br>
   AsmPrinter.cpp<br>
   AsmPrinterDwarf.cpp<br>
   AsmPrinterInlineAsm.cpp<br>
-  DbgEntityHistoryCalculator.cpp<br>
+  DbgValueHistoryCalculator.cpp<br>
   DebugHandlerBase.cpp<br>
   DebugLocStream.cpp<br>
   DIE.cpp<br>
<br>
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/CodeViewDebug.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/CodeViewDebug.h?rev=337812&r1=337811&r2=337812&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/CodeViewDebug.h?rev=337812&r1=337811&r2=337812&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/CodeGen/AsmPrinter/CodeViewDebug.h (original)<br>
+++ llvm/trunk/lib/CodeGen/AsmPrinter/CodeViewDebug.h Mon Jul 23 23:17:45 2018<br>
@@ -14,7 +14,7 @@<br>
 #ifndef LLVM_LIB_CODEGEN_ASMPRINTER_CODEVIEWDEBUG_H<br>
 #define LLVM_LIB_CODEGEN_ASMPRINTER_CODEVIEWDEBUG_H<br>
<br>
-#include "DbgEntityHistoryCalculator.h"<br>
+#include "DbgValueHistoryCalculator.h"<br>
 #include "DebugHandlerBase.h"<br>
 #include "llvm/ADT/ArrayRef.h"<br>
 #include "llvm/ADT/DenseMap.h"<br>
<br>
Removed: llvm/trunk/lib/CodeGen/AsmPrinter/DbgEntityHistoryCalculator.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DbgEntityHistoryCalculator.cpp?rev=337811&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DbgEntityHistoryCalculator.cpp?rev=337811&view=auto</a><br>
==============================================================================<br>
--- llvm/trunk/lib/CodeGen/AsmPrinter/DbgEntityHistoryCalculator.cpp (original)<br>
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DbgEntityHistoryCalculator.cpp (removed)<br>
@@ -1,316 +0,0 @@<br>
-//===- llvm/CodeGen/AsmPrinter/DbgEntityHistoryCalculator.cpp -------------===//<br>
-//<br>
-//                     The LLVM Compiler Infrastructure<br>
-//<br>
-// This file is distributed under the University of Illinois Open Source<br>
-// License. See LICENSE.TXT for details.<br>
-//<br>
-//===----------------------------------------------------------------------===//<br>
-<br>
-#include "DbgEntityHistoryCalculator.h"<br>
-#include "llvm/ADT/BitVector.h"<br>
-#include "llvm/ADT/STLExtras.h"<br>
-#include "llvm/ADT/SmallVector.h"<br>
-#include "llvm/CodeGen/MachineBasicBlock.h"<br>
-#include "llvm/CodeGen/MachineFunction.h"<br>
-#include "llvm/CodeGen/MachineInstr.h"<br>
-#include "llvm/CodeGen/MachineOperand.h"<br>
-#include "llvm/CodeGen/TargetLowering.h"<br>
-#include "llvm/CodeGen/TargetRegisterInfo.h"<br>
-#include "llvm/CodeGen/TargetSubtargetInfo.h"<br>
-#include "llvm/IR/DebugInfoMetadata.h"<br>
-#include "llvm/IR/DebugLoc.h"<br>
-#include "llvm/MC/MCRegisterInfo.h"<br>
-#include "llvm/Support/Debug.h"<br>
-#include "llvm/Support/raw_ostream.h"<br>
-#include <cassert><br>
-#include <map><br>
-#include <utility><br>
-<br>
-using namespace llvm;<br>
-<br>
-#define DEBUG_TYPE "dwarfdebug"<br>
-<br>
-// If @MI is a DBG_VALUE with debug value described by a<br>
-// defined register, returns the number of this register.<br>
-// In the other case, returns 0.<br>
-static unsigned isDescribedByReg(const MachineInstr &MI) {<br>
-  assert(MI.isDebugValue());<br>
-  assert(MI.getNumOperands() == 4);<br>
-  // If location of variable is described using a register (directly or<br>
-  // indirectly), this register is always a first operand.<br>
-  return MI.getOperand(0).isReg() ? MI.getOperand(0).getReg() : 0;<br>
-}<br>
-<br>
-void DbgValueHistoryMap::startInstrRange(InlinedVariable Var,<br>
-                                         const MachineInstr &MI) {<br>
-  // Instruction range should start with a DBG_VALUE instruction for the<br>
-  // variable.<br>
-  assert(MI.isDebugValue() && "not a DBG_VALUE");<br>
-  auto &Ranges = VarInstrRanges[Var];<br>
-  if (!Ranges.empty() && Ranges.back().second == nullptr &&<br>
-      Ranges.back().first->isIdenticalTo(MI)) {<br>
-    LLVM_DEBUG(dbgs() << "Coalescing identical DBG_VALUE entries:\n"<br>
-                      << "\t" << Ranges.back().first << "\t" << MI << "\n");<br>
-    return;<br>
-  }<br>
-  Ranges.push_back(std::make_pair(&MI, nullptr));<br>
-}<br>
-<br>
-void DbgValueHistoryMap::endInstrRange(InlinedVariable Var,<br>
-                                       const MachineInstr &MI) {<br>
-  auto &Ranges = VarInstrRanges[Var];<br>
-  // Verify that the current instruction range is not yet closed.<br>
-  assert(!Ranges.empty() && Ranges.back().second == nullptr);<br>
-  // For now, instruction ranges are not allowed to cross basic block<br>
-  // boundaries.<br>
-  assert(Ranges.back().first->getParent() == MI.getParent());<br>
-  Ranges.back().second = &MI;<br>
-}<br>
-<br>
-unsigned DbgValueHistoryMap::getRegisterForVar(InlinedVariable Var) const {<br>
-  const auto &I = VarInstrRanges.find(Var);<br>
-  if (I == VarInstrRanges.end())<br>
-    return 0;<br>
-  const auto &Ranges = I->second;<br>
-  if (Ranges.empty() || Ranges.back().second != nullptr)<br>
-    return 0;<br>
-  return isDescribedByReg(*Ranges.back().first);<br>
-}<br>
-<br>
-void DbgLabelInstrMap::addInstr(InlinedLabel Label, const MachineInstr &MI) {<br>
-  assert(MI.isDebugLabel() && "not a DBG_LABEL");<br>
-  LabelInstr[Label] = &MI;<br>
-}<br>
-<br>
-namespace {<br>
-<br>
-// Maps physreg numbers to the variables they describe.<br>
-using InlinedVariable = DbgValueHistoryMap::InlinedVariable;<br>
-using RegDescribedVarsMap = std::map<unsigned, SmallVector<InlinedVariable, 1>>;<br>
-using InlinedLabel = DbgLabelInstrMap::InlinedLabel;<br>
-<br>
-} // end anonymous namespace<br>
-<br>
-// Claim that @Var is not described by @RegNo anymore.<br>
-static void dropRegDescribedVar(RegDescribedVarsMap &RegVars, unsigned RegNo,<br>
-                                InlinedVariable Var) {<br>
-  const auto &I = RegVars.find(RegNo);<br>
-  assert(RegNo != 0U && I != RegVars.end());<br>
-  auto &VarSet = I->second;<br>
-  const auto &VarPos = llvm::find(VarSet, Var);<br>
-  assert(VarPos != VarSet.end());<br>
-  VarSet.erase(VarPos);<br>
-  // Don't keep empty sets in a map to keep it as small as possible.<br>
-  if (VarSet.empty())<br>
-    RegVars.erase(I);<br>
-}<br>
-<br>
-// Claim that @Var is now described by @RegNo.<br>
-static void addRegDescribedVar(RegDescribedVarsMap &RegVars, unsigned RegNo,<br>
-                               InlinedVariable Var) {<br>
-  assert(RegNo != 0U);<br>
-  auto &VarSet = RegVars[RegNo];<br>
-  assert(!is_contained(VarSet, Var));<br>
-  VarSet.push_back(Var);<br>
-}<br>
-<br>
-// Terminate the location range for variables described by register at<br>
-// @I by inserting @ClobberingInstr to their history.<br>
-static void clobberRegisterUses(RegDescribedVarsMap &RegVars,<br>
-                                RegDescribedVarsMap::iterator I,<br>
-                                DbgValueHistoryMap &HistMap,<br>
-                                const MachineInstr &ClobberingInstr) {<br>
-  // Iterate over all variables described by this register and add this<br>
-  // instruction to their history, clobbering it.<br>
-  for (const auto &Var : I->second)<br>
-    HistMap.endInstrRange(Var, ClobberingInstr);<br>
-  RegVars.erase(I);<br>
-}<br>
-<br>
-// Terminate the location range for variables described by register<br>
-// @RegNo by inserting @ClobberingInstr to their history.<br>
-static void clobberRegisterUses(RegDescribedVarsMap &RegVars, unsigned RegNo,<br>
-                                DbgValueHistoryMap &HistMap,<br>
-                                const MachineInstr &ClobberingInstr) {<br>
-  const auto &I = RegVars.find(RegNo);<br>
-  if (I == RegVars.end())<br>
-    return;<br>
-  clobberRegisterUses(RegVars, I, HistMap, ClobberingInstr);<br>
-}<br>
-<br>
-// Returns the first instruction in @MBB which corresponds to<br>
-// the function epilogue, or nullptr if @MBB doesn't contain an epilogue.<br>
-static const MachineInstr *getFirstEpilogueInst(const MachineBasicBlock &MBB) {<br>
-  auto LastMI = MBB.getLastNonDebugInstr();<br>
-  if (LastMI == MBB.end() || !LastMI->isReturn())<br>
-    return nullptr;<br>
-  // Assume that epilogue starts with instruction having the same debug location<br>
-  // as the return instruction.<br>
-  DebugLoc LastLoc = LastMI->getDebugLoc();<br>
-  auto Res = LastMI;<br>
-  for (MachineBasicBlock::const_reverse_iterator I = LastMI.getReverse(),<br>
-                                                 E = MBB.rend();<br>
-       I != E; ++I) {<br>
-    if (I->getDebugLoc() != LastLoc)<br>
-      return &*Res;<br>
-    Res = &*I;<br>
-  }<br>
-  // If all instructions have the same debug location, assume whole MBB is<br>
-  // an epilogue.<br>
-  return &*MBB.begin();<br>
-}<br>
-<br>
-// Collect registers that are modified in the function body (their<br>
-// contents is changed outside of the prologue and epilogue).<br>
-static void collectChangingRegs(const MachineFunction *MF,<br>
-                                const TargetRegisterInfo *TRI,<br>
-                                BitVector &Regs) {<br>
-  for (const auto &MBB : *MF) {<br>
-    auto FirstEpilogueInst = getFirstEpilogueInst(MBB);<br>
-<br>
-    for (const auto &MI : MBB) {<br>
-      // Avoid looking at prologue or epilogue instructions.<br>
-      if (&MI == FirstEpilogueInst)<br>
-        break;<br>
-      if (MI.getFlag(MachineInstr::FrameSetup))<br>
-        continue;<br>
-<br>
-      // Look for register defs and register masks. Register masks are<br>
-      // typically on calls and they clobber everything not in the mask.<br>
-      for (const MachineOperand &MO : MI.operands()) {<br>
-        // Skip virtual registers since they are handled by the parent.<br>
-        if (MO.isReg() && MO.isDef() && MO.getReg() &&<br>
-            !TRI->isVirtualRegister(MO.getReg())) {<br>
-          for (MCRegAliasIterator AI(MO.getReg(), TRI, true); AI.isValid();<br>
-               ++AI)<br>
-            Regs.set(*AI);<br>
-        } else if (MO.isRegMask()) {<br>
-          Regs.setBitsNotInMask(MO.getRegMask());<br>
-        }<br>
-      }<br>
-    }<br>
-  }<br>
-}<br>
-<br>
-void llvm::calculateDbgEntityHistory(const MachineFunction *MF,<br>
-                                     const TargetRegisterInfo *TRI,<br>
-                                     DbgValueHistoryMap &DbgValues,<br>
-                                     DbgLabelInstrMap &DbgLabels) {<br>
-  BitVector ChangingRegs(TRI->getNumRegs());<br>
-  collectChangingRegs(MF, TRI, ChangingRegs);<br>
-<br>
-  const TargetLowering *TLI = MF->getSubtarget().getTargetLowering();<br>
-  unsigned SP = TLI->getStackPointerRegisterToSaveRestore();<br>
-  RegDescribedVarsMap RegVars;<br>
-  for (const auto &MBB : *MF) {<br>
-    for (const auto &MI : MBB) {<br>
-      if (!MI.isDebugInstr()) {<br>
-        // Not a DBG_VALUE instruction. It may clobber registers which describe<br>
-        // some variables.<br>
-        for (const MachineOperand &MO : MI.operands()) {<br>
-          if (MO.isReg() && MO.isDef() && MO.getReg()) {<br>
-            // Ignore call instructions that claim to clobber SP. The AArch64<br>
-            // backend does this for aggregate function arguments.<br>
-            if (MI.isCall() && MO.getReg() == SP)<br>
-              continue;<br>
-            // If this is a virtual register, only clobber it since it doesn't<br>
-            // have aliases.<br>
-            if (TRI->isVirtualRegister(MO.getReg()))<br>
-              clobberRegisterUses(RegVars, MO.getReg(), DbgValues, MI);<br>
-            // If this is a register def operand, it may end a debug value<br>
-            // range.<br>
-            else {<br>
-              for (MCRegAliasIterator AI(MO.getReg(), TRI, true); AI.isValid();<br>
-                   ++AI)<br>
-                if (ChangingRegs.test(*AI))<br>
-                  clobberRegisterUses(RegVars, *AI, DbgValues, MI);<br>
-            }<br>
-          } else if (MO.isRegMask()) {<br>
-            // If this is a register mask operand, clobber all debug values in<br>
-            // non-CSRs.<br>
-            for (unsigned I : ChangingRegs.set_bits()) {<br>
-              // Don't consider SP to be clobbered by register masks.<br>
-              if (unsigned(I) != SP && TRI->isPhysicalRegister(I) &&<br>
-                  MO.clobbersPhysReg(I)) {<br>
-                clobberRegisterUses(RegVars, I, DbgValues, MI);<br>
-              }<br>
-            }<br>
-          }<br>
-        }<br>
-        continue;<br>
-      }<br>
-<br>
-      if (MI.isDebugValue()) {<br>
-        assert(MI.getNumOperands() > 1 && "Invalid DBG_VALUE instruction!");<br>
-        // Use the base variable (without any DW_OP_piece expressions)<br>
-        // as index into History. The full variables including the<br>
-        // piece expressions are attached to the MI.<br>
-        const DILocalVariable *RawVar = MI.getDebugVariable();<br>
-        assert(RawVar->isValidLocationForIntrinsic(MI.getDebugLoc()) &&<br>
-               "Expected inlined-at fields to agree");<br>
-        InlinedVariable Var(RawVar, MI.getDebugLoc()->getInlinedAt());<br>
-<br>
-        if (unsigned PrevReg = DbgValues.getRegisterForVar(Var))<br>
-          dropRegDescribedVar(RegVars, PrevReg, Var);<br>
-<br>
-        DbgValues.startInstrRange(Var, MI);<br>
-<br>
-        if (unsigned NewReg = isDescribedByReg(MI))<br>
-          addRegDescribedVar(RegVars, NewReg, Var);<br>
-      } else if (MI.isDebugLabel()) {<br>
-        assert(MI.getNumOperands() == 1 && "Invalid DBG_LABEL instruction!");<br>
-        const DILabel *RawLabel = MI.getDebugLabel();<br>
-        assert(RawLabel->isValidLocationForIntrinsic(MI.getDebugLoc()) &&<br>
-            "Expected inlined-at fields to agree");<br>
-        // When collecting debug information for labels, there is no MCSymbol<br>
-        // generated for it. So, we keep MachineInstr in DbgLabels in order<br>
-        // to query MCSymbol afterward.<br>
-        InlinedLabel L(RawLabel, MI.getDebugLoc()->getInlinedAt());<br>
-        DbgLabels.addInstr(L, MI);<br>
-      }<br>
-    }<br>
-<br>
-    // Make sure locations for register-described variables are valid only<br>
-    // until the end of the basic block (unless it's the last basic block, in<br>
-    // which case let their liveness run off to the end of the function).<br>
-    if (!MBB.empty() && &MBB != &MF->back()) {<br>
-      for (auto I = RegVars.begin(), E = RegVars.end(); I != E;) {<br>
-        auto CurElem = I++; // CurElem can be erased below.<br>
-        if (TRI->isVirtualRegister(CurElem->first) ||<br>
-            ChangingRegs.test(CurElem->first))<br>
-          clobberRegisterUses(RegVars, CurElem, DbgValues, MBB.back());<br>
-      }<br>
-    }<br>
-  }<br>
-}<br>
-<br>
-#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)<br>
-LLVM_DUMP_METHOD void DbgValueHistoryMap::dump() const {<br>
-  dbgs() << "DbgValueHistoryMap:\n";<br>
-  for (const auto &VarRangePair : *this) {<br>
-    const InlinedVariable &Var = VarRangePair.first;<br>
-    const InstrRanges &Ranges = VarRangePair.second;<br>
-<br>
-    const DILocalVariable *LocalVar = Var.first;<br>
-    const DILocation *Location = Var.second;<br>
-<br>
-    dbgs() << " - " << LocalVar->getName() << " at ";<br>
-<br>
-    if (Location)<br>
-      dbgs() << Location->getFilename() << ":" << Location->getLine() << ":"<br>
-             << Location->getColumn();<br>
-    else<br>
-      dbgs() << "<unknown location>";<br>
-<br>
-    dbgs() << " --\n";<br>
-<br>
-    for (const InstrRange &Range : Ranges) {<br>
-      dbgs() << "   Begin: " << *Range.first;<br>
-      if (Range.second)<br>
-        dbgs() << "   End  : " << *Range.second;<br>
-      dbgs() << "\n";<br>
-    }<br>
-  }<br>
-}<br>
-#endif<br>
<br>
Removed: llvm/trunk/lib/CodeGen/AsmPrinter/DbgEntityHistoryCalculator.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DbgEntityHistoryCalculator.h?rev=337811&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DbgEntityHistoryCalculator.h?rev=337811&view=auto</a><br>
==============================================================================<br>
--- llvm/trunk/lib/CodeGen/AsmPrinter/DbgEntityHistoryCalculator.h (original)<br>
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DbgEntityHistoryCalculator.h (removed)<br>
@@ -1,88 +0,0 @@<br>
-//===- llvm/CodeGen/AsmPrinter/DbgEntityHistoryCalculator.h -----*- C++ -*-===//<br>
-//<br>
-//                     The LLVM Compiler Infrastructure<br>
-//<br>
-// This file is distributed under the University of Illinois Open Source<br>
-// License. See LICENSE.TXT for details.<br>
-//<br>
-//===----------------------------------------------------------------------===//<br>
-<br>
-#ifndef LLVM_LIB_CODEGEN_ASMPRINTER_DBGVALUEHISTORYCALCULATOR_H<br>
-#define LLVM_LIB_CODEGEN_ASMPRINTER_DBGVALUEHISTORYCALCULATOR_H<br>
-<br>
-#include "llvm/ADT/MapVector.h"<br>
-#include "llvm/ADT/SmallVector.h"<br>
-#include "llvm/IR/DebugInfoMetadata.h"<br>
-#include <utility><br>
-<br>
-namespace llvm {<br>
-<br>
-class DILocalVariable;<br>
-class MachineFunction;<br>
-class MachineInstr;<br>
-class TargetRegisterInfo;<br>
-<br>
-// For each user variable, keep a list of instruction ranges where this variable<br>
-// is accessible. The variables are listed in order of appearance.<br>
-class DbgValueHistoryMap {<br>
-  // Each instruction range starts with a DBG_VALUE instruction, specifying the<br>
-  // location of a variable, which is assumed to be valid until the end of the<br>
-  // range. If end is not specified, location is valid until the start<br>
-  // instruction of the next instruction range, or until the end of the<br>
-  // function.<br>
-public:<br>
-  using InstrRange = std::pair<const MachineInstr *, const MachineInstr *>;<br>
-  using InstrRanges = SmallVector<InstrRange, 4>;<br>
-  using InlinedVariable =<br>
-      std::pair<const DILocalVariable *, const DILocation *>;<br>
-  using InstrRangesMap = MapVector<InlinedVariable, InstrRanges>;<br>
-<br>
-private:<br>
-  InstrRangesMap VarInstrRanges;<br>
-<br>
-public:<br>
-  void startInstrRange(InlinedVariable Var, const MachineInstr &MI);<br>
-  void endInstrRange(InlinedVariable Var, const MachineInstr &MI);<br>
-<br>
-  // Returns register currently describing @Var. If @Var is currently<br>
-  // unaccessible or is not described by a register, returns 0.<br>
-  unsigned getRegisterForVar(InlinedVariable Var) const;<br>
-<br>
-  bool empty() const { return VarInstrRanges.empty(); }<br>
-  void clear() { VarInstrRanges.clear(); }<br>
-  InstrRangesMap::const_iterator begin() const { return VarInstrRanges.begin(); }<br>
-  InstrRangesMap::const_iterator end() const { return VarInstrRanges.end(); }<br>
-<br>
-#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)<br>
-  LLVM_DUMP_METHOD void dump() const;<br>
-#endif<br>
-};<br>
-<br>
-/// For each inlined instance of a source-level label, keep the corresponding<br>
-/// DBG_LABEL instruction. The DBG_LABEL instruction could be used to generate<br>
-/// a temporary (assembler) label before it.<br>
-class DbgLabelInstrMap {<br>
-public:<br>
-  using InlinedLabel = std::pair<const DILabel *, const DILocation *>;<br>
-  using InstrMap = MapVector<InlinedLabel, const MachineInstr *>;<br>
-<br>
-private:<br>
-  InstrMap LabelInstr;<br>
-<br>
-public:<br>
-  void  addInstr(InlinedLabel Label, const MachineInstr &MI);<br>
-<br>
-  bool empty() const { return LabelInstr.empty(); }<br>
-  void clear() { LabelInstr.clear(); }<br>
-  InstrMap::const_iterator begin() const { return LabelInstr.begin(); }<br>
-  InstrMap::const_iterator end() const { return LabelInstr.end(); }<br>
-};<br>
-<br>
-void calculateDbgEntityHistory(const MachineFunction *MF,<br>
-                               const TargetRegisterInfo *TRI,<br>
-                               DbgValueHistoryMap &DbgValues,<br>
-                               DbgLabelInstrMap &DbgLabels);<br>
-<br>
-} // end namespace llvm<br>
-<br>
-#endif // LLVM_LIB_CODEGEN_ASMPRINTER_DBGVALUEHISTORYCALCULATOR_H<br>
<br>
Copied: llvm/trunk/lib/CodeGen/AsmPrinter/DbgValueHistoryCalculator.cpp (from r337806, llvm/trunk/lib/CodeGen/AsmPrinter/DbgEntityHistoryCalculator.cpp)<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DbgValueHistoryCalculator.cpp?p2=llvm/trunk/lib/CodeGen/AsmPrinter/DbgValueHistoryCalculator.cpp&p1=llvm/trunk/lib/CodeGen/AsmPrinter/DbgEntityHistoryCalculator.cpp&r1=337806&r2=337812&rev=337812&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DbgValueHistoryCalculator.cpp?p2=llvm/trunk/lib/CodeGen/AsmPrinter/DbgValueHistoryCalculator.cpp&p1=llvm/trunk/lib/CodeGen/AsmPrinter/DbgEntityHistoryCalculator.cpp&r1=337806&r2=337812&rev=337812&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/CodeGen/AsmPrinter/DbgEntityHistoryCalculator.cpp (original)<br>
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DbgValueHistoryCalculator.cpp Mon Jul 23 23:17:45 2018<br>
@@ -1,4 +1,4 @@<br>
-//===- llvm/CodeGen/AsmPrinter/DbgEntityHistoryCalculator.cpp -------------===//<br>
+//===- llvm/CodeGen/AsmPrinter/DbgValueHistoryCalculator.cpp --------------===//<br>
 //<br>
 //                     The LLVM Compiler Infrastructure<br>
 //<br>
@@ -7,7 +7,7 @@<br>
 //<br>
 //===----------------------------------------------------------------------===//<br>
<br>
-#include "DbgEntityHistoryCalculator.h"<br>
+#include "DbgValueHistoryCalculator.h"<br>
 #include "llvm/ADT/BitVector.h"<br>
 #include "llvm/ADT/STLExtras.h"<br>
 #include "llvm/ADT/SmallVector.h"<br>
@@ -78,17 +78,11 @@ unsigned DbgValueHistoryMap::getRegister<br>
   return isDescribedByReg(*Ranges.back().first);<br>
 }<br>
<br>
-void DbgLabelInstrMap::addInstr(InlinedLabel Label, const MachineInstr &MI) {<br>
-  assert(MI.isDebugLabel() && "not a DBG_LABEL");<br>
-  LabelInstr[Label] = &MI;<br>
-}<br>
-<br>
 namespace {<br>
<br>
 // Maps physreg numbers to the variables they describe.<br>
 using InlinedVariable = DbgValueHistoryMap::InlinedVariable;<br>
 using RegDescribedVarsMap = std::map<unsigned, SmallVector<InlinedVariable, 1>>;<br>
-using InlinedLabel = DbgLabelInstrMap::InlinedLabel;<br>
<br>
 } // end anonymous namespace<br>
<br>
@@ -193,10 +187,9 @@ static void collectChangingRegs(const Ma<br>
   }<br>
 }<br>
<br>
-void llvm::calculateDbgEntityHistory(const MachineFunction *MF,<br>
-                                     const TargetRegisterInfo *TRI,<br>
-                                     DbgValueHistoryMap &DbgValues,<br>
-                                     DbgLabelInstrMap &DbgLabels) {<br>
+void llvm::calculateDbgValueHistory(const MachineFunction *MF,<br>
+                                    const TargetRegisterInfo *TRI,<br>
+                                    DbgValueHistoryMap &Result) {<br>
   BitVector ChangingRegs(TRI->getNumRegs());<br>
   collectChangingRegs(MF, TRI, ChangingRegs);<br>
<br>
@@ -217,14 +210,14 @@ void llvm::calculateDbgEntityHistory(con<br>
             // If this is a virtual register, only clobber it since it doesn't<br>
             // have aliases.<br>
             if (TRI->isVirtualRegister(MO.getReg()))<br>
-              clobberRegisterUses(RegVars, MO.getReg(), DbgValues, MI);<br>
+              clobberRegisterUses(RegVars, MO.getReg(), Result, MI);<br>
             // If this is a register def operand, it may end a debug value<br>
             // range.<br>
             else {<br>
               for (MCRegAliasIterator AI(MO.getReg(), TRI, true); AI.isValid();<br>
                    ++AI)<br>
                 if (ChangingRegs.test(*AI))<br>
-                  clobberRegisterUses(RegVars, *AI, DbgValues, MI);<br>
+                  clobberRegisterUses(RegVars, *AI, Result, MI);<br>
             }<br>
           } else if (MO.isRegMask()) {<br>
             // If this is a register mask operand, clobber all debug values in<br>
@@ -233,7 +226,7 @@ void llvm::calculateDbgEntityHistory(con<br>
               // Don't consider SP to be clobbered by register masks.<br>
               if (unsigned(I) != SP && TRI->isPhysicalRegister(I) &&<br>
                   MO.clobbersPhysReg(I)) {<br>
-                clobberRegisterUses(RegVars, I, DbgValues, MI);<br>
+                clobberRegisterUses(RegVars, I, Result, MI);<br>
               }<br>
             }<br>
           }<br>
@@ -241,34 +234,26 @@ void llvm::calculateDbgEntityHistory(con<br>
         continue;<br>
       }<br>
<br>
-      if (MI.isDebugValue()) {<br>
-        assert(MI.getNumOperands() > 1 && "Invalid DBG_VALUE instruction!");<br>
-        // Use the base variable (without any DW_OP_piece expressions)<br>
-        // as index into History. The full variables including the<br>
-        // piece expressions are attached to the MI.<br>
-        const DILocalVariable *RawVar = MI.getDebugVariable();<br>
-        assert(RawVar->isValidLocationForIntrinsic(MI.getDebugLoc()) &&<br>
-               "Expected inlined-at fields to agree");<br>
-        InlinedVariable Var(RawVar, MI.getDebugLoc()->getInlinedAt());<br>
-<br>
-        if (unsigned PrevReg = DbgValues.getRegisterForVar(Var))<br>
-          dropRegDescribedVar(RegVars, PrevReg, Var);<br>
-<br>
-        DbgValues.startInstrRange(Var, MI);<br>
-<br>
-        if (unsigned NewReg = isDescribedByReg(MI))<br>
-          addRegDescribedVar(RegVars, NewReg, Var);<br>
-      } else if (MI.isDebugLabel()) {<br>
-        assert(MI.getNumOperands() == 1 && "Invalid DBG_LABEL instruction!");<br>
-        const DILabel *RawLabel = MI.getDebugLabel();<br>
-        assert(RawLabel->isValidLocationForIntrinsic(MI.getDebugLoc()) &&<br>
-            "Expected inlined-at fields to agree");<br>
-        // When collecting debug information for labels, there is no MCSymbol<br>
-        // generated for it. So, we keep MachineInstr in DbgLabels in order<br>
-        // to query MCSymbol afterward.<br>
-        InlinedLabel L(RawLabel, MI.getDebugLoc()->getInlinedAt());<br>
-        DbgLabels.addInstr(L, MI);<br>
-      }<br>
+      // Skip DBG_LABEL instructions.<br>
+      if (MI.isDebugLabel())<br>
+        continue;<br>
+<br>
+      assert(MI.getNumOperands() > 1 && "Invalid DBG_VALUE instruction!");<br>
+      // Use the base variable (without any DW_OP_piece expressions)<br>
+      // as index into History. The full variables including the<br>
+      // piece expressions are attached to the MI.<br>
+      const DILocalVariable *RawVar = MI.getDebugVariable();<br>
+      assert(RawVar->isValidLocationForIntrinsic(MI.getDebugLoc()) &&<br>
+             "Expected inlined-at fields to agree");<br>
+      InlinedVariable Var(RawVar, MI.getDebugLoc()->getInlinedAt());<br>
+<br>
+      if (unsigned PrevReg = Result.getRegisterForVar(Var))<br>
+        dropRegDescribedVar(RegVars, PrevReg, Var);<br>
+<br>
+      Result.startInstrRange(Var, MI);<br>
+<br>
+      if (unsigned NewReg = isDescribedByReg(MI))<br>
+        addRegDescribedVar(RegVars, NewReg, Var);<br>
     }<br>
<br>
     // Make sure locations for register-described variables are valid only<br>
@@ -279,7 +264,7 @@ void llvm::calculateDbgEntityHistory(con<br>
         auto CurElem = I++; // CurElem can be erased below.<br>
         if (TRI->isVirtualRegister(CurElem->first) ||<br>
             ChangingRegs.test(CurElem->first))<br>
-          clobberRegisterUses(RegVars, CurElem, DbgValues, MBB.back());<br>
+          clobberRegisterUses(RegVars, CurElem, Result, MBB.back());<br>
       }<br>
     }<br>
   }<br>
<br>
Copied: llvm/trunk/lib/CodeGen/AsmPrinter/DbgValueHistoryCalculator.h (from r337806, llvm/trunk/lib/CodeGen/AsmPrinter/DbgEntityHistoryCalculator.h)<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DbgValueHistoryCalculator.h?p2=llvm/trunk/lib/CodeGen/AsmPrinter/DbgValueHistoryCalculator.h&p1=llvm/trunk/lib/CodeGen/AsmPrinter/DbgEntityHistoryCalculator.h&r1=337806&r2=337812&rev=337812&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DbgValueHistoryCalculator.h?p2=llvm/trunk/lib/CodeGen/AsmPrinter/DbgValueHistoryCalculator.h&p1=llvm/trunk/lib/CodeGen/AsmPrinter/DbgEntityHistoryCalculator.h&r1=337806&r2=337812&rev=337812&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/CodeGen/AsmPrinter/DbgEntityHistoryCalculator.h (original)<br>
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DbgValueHistoryCalculator.h Mon Jul 23 23:17:45 2018<br>
@@ -1,4 +1,4 @@<br>
-//===- llvm/CodeGen/AsmPrinter/DbgEntityHistoryCalculator.h -----*- C++ -*-===//<br>
+//===- llvm/CodeGen/AsmPrinter/DbgValueHistoryCalculator.h ------*- C++ -*-===//<br>
 //<br>
 //                     The LLVM Compiler Infrastructure<br>
 //<br>
@@ -58,30 +58,9 @@ public:<br>
 #endif<br>
 };<br>
<br>
-/// For each inlined instance of a source-level label, keep the corresponding<br>
-/// DBG_LABEL instruction. The DBG_LABEL instruction could be used to generate<br>
-/// a temporary (assembler) label before it.<br>
-class DbgLabelInstrMap {<br>
-public:<br>
-  using InlinedLabel = std::pair<const DILabel *, const DILocation *>;<br>
-  using InstrMap = MapVector<InlinedLabel, const MachineInstr *>;<br>
-<br>
-private:<br>
-  InstrMap LabelInstr;<br>
-<br>
-public:<br>
-  void  addInstr(InlinedLabel Label, const MachineInstr &MI);<br>
-<br>
-  bool empty() const { return LabelInstr.empty(); }<br>
-  void clear() { LabelInstr.clear(); }<br>
-  InstrMap::const_iterator begin() const { return LabelInstr.begin(); }<br>
-  InstrMap::const_iterator end() const { return LabelInstr.end(); }<br>
-};<br>
-<br>
-void calculateDbgEntityHistory(const MachineFunction *MF,<br>
-                               const TargetRegisterInfo *TRI,<br>
-                               DbgValueHistoryMap &DbgValues,<br>
-                               DbgLabelInstrMap &DbgLabels);<br>
+void calculateDbgValueHistory(const MachineFunction *MF,<br>
+                              const TargetRegisterInfo *TRI,<br>
+                              DbgValueHistoryMap &Result);<br>
<br>
 } // end namespace llvm<br>
<br>
<br>
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp?rev=337812&r1=337811&r2=337812&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp?rev=337812&r1=337811&r2=337812&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp (original)<br>
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp Mon Jul 23 23:17:45 2018<br>
@@ -190,9 +190,8 @@ void DebugHandlerBase::beginFunction(con<br>
<br>
   // Calculate history for local variables.<br>
   assert(DbgValues.empty() && "DbgValues map wasn't cleaned!");<br>
-  assert(DbgLabels.empty() && "DbgLabels map wasn't cleaned!");<br>
-  calculateDbgEntityHistory(MF, Asm->MF->getSubtarget().getRegisterInfo(),<br>
-                            DbgValues, DbgLabels);<br>
+  calculateDbgValueHistory(MF, Asm->MF->getSubtarget().getRegisterInfo(),<br>
+                           DbgValues);<br>
   LLVM_DEBUG(DbgValues.dump());<br>
<br>
   // Request labels for the full history.<br>
@@ -230,12 +229,6 @@ void DebugHandlerBase::beginFunction(con<br>
     }<br>
   }<br>
<br>
-  // Ensure there is a symbol before DBG_LABEL.<br>
-  for (const auto &I : DbgLabels) {<br>
-    const MachineInstr *MI = I.second;<br>
-    requestLabelBeforeInsn(MI);<br>
-  }<br>
-<br>
   PrevInstLoc = DebugLoc();<br>
   PrevLabel = Asm->getFunctionBegin();<br>
   beginFunctionImpl(MF);<br>
@@ -303,7 +296,6 @@ void DebugHandlerBase::endFunction(const<br>
   if (hasDebugInfo(MMI, MF))<br>
     endFunctionImpl(MF);<br>
   DbgValues.clear();<br>
-  DbgLabels.clear();<br>
   LabelsBeforeInsn.clear();<br>
   LabelsAfterInsn.clear();<br>
 }<br>
<br>
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DebugHandlerBase.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DebugHandlerBase.h?rev=337812&r1=337811&r2=337812&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DebugHandlerBase.h?rev=337812&r1=337811&r2=337812&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/CodeGen/AsmPrinter/DebugHandlerBase.h (original)<br>
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DebugHandlerBase.h Mon Jul 23 23:17:45 2018<br>
@@ -16,7 +16,7 @@<br>
 #define LLVM_LIB_CODEGEN_ASMPRINTER_DEBUGHANDLERBASE_H<br>
<br>
 #include "AsmPrinterHandler.h"<br>
-#include "DbgEntityHistoryCalculator.h"<br>
+#include "DbgValueHistoryCalculator.h"<br>
 #include "llvm/ADT/Optional.h"<br>
 #include "llvm/CodeGen/LexicalScopes.h"<br>
 #include "llvm/CodeGen/MachineInstr.h"<br>
@@ -82,9 +82,6 @@ protected:<br>
   /// variable.  Variables are listed in order of appearance.<br>
   DbgValueHistoryMap DbgValues;<br>
<br>
-  /// Mapping of inlined labels and DBG_LABEL machine instruction.<br>
-  DbgLabelInstrMap DbgLabels;<br>
-<br>
   /// Maps instruction with label emitted before instruction.<br>
   /// FIXME: Make this private from DwarfDebug, we have the necessary accessors<br>
   /// for it.<br>
<br>
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp?rev=337812&r1=337811&r2=337812&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp?rev=337812&r1=337811&r2=337812&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp (original)<br>
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp Mon Jul 23 23:17:45 2018<br>
@@ -502,18 +502,6 @@ DIE *DwarfCompileUnit::constructVariable<br>
   return D;<br>
 }<br>
<br>
-DIE *DwarfCompileUnit::constructLabelDIE(DbgLabel &DL,<br>
-                                         const LexicalScope &Scope) {<br>
-  auto LabelDie = DIE::get(DIEValueAllocator, DL.getTag());<br>
-  insertDIE(DL.getLabel(), LabelDie);<br>
-  DL.setDIE(*LabelDie);<br>
-<br>
-  if (Scope.isAbstractScope())<br>
-    applyLabelAttributes(DL, *LabelDie);<br>
-<br>
-  return LabelDie;<br>
-}<br>
-<br>
 DIE *DwarfCompileUnit::constructVariableDIEImpl(const DbgVariable &DV,<br>
                                                 bool Abstract) {<br>
   // Define variable debug information entry.<br>
@@ -704,9 +692,6 @@ DIE *DwarfCompileUnit::createScopeChildr<br>
   if (HasNonScopeChildren)<br>
     *HasNonScopeChildren = !Children.empty();<br>
<br>
-  for (DbgLabel *DL : DU->getScopeLabels().lookup(Scope))<br>
-    Children.push_back(constructLabelDIE(*DL, *Scope));<br>
-<br>
   for (LexicalScope *LS : Scope->getChildren())<br>
     constructScopeDIE(LS, Children);<br>
<br>
@@ -832,52 +817,40 @@ void DwarfCompileUnit::finishSubprogramD<br>
   }<br>
 }<br>
<br>
-void DwarfCompileUnit::finishEntityDefinition(const DbgEntity *Entity) {<br>
-  DbgEntity *AbsEntity = getExistingAbstractEntity(Entity->getEntity());<br>
-<br>
-  auto *Die = Entity->getDIE();<br>
-  /// Label may be used to generate DW_AT_low_pc, so put it outside<br>
-  /// if/else block.<br>
-  const DbgLabel *Label = nullptr;<br>
-  if (AbsEntity && AbsEntity->getDIE()) {<br>
-    addDIEEntry(*Die, dwarf::DW_AT_abstract_origin, *AbsEntity->getDIE());<br>
-    Label = dyn_cast<const DbgLabel>(Entity);<br>
-  } else {<br>
-    if (const DbgVariable *Var = dyn_cast<const DbgVariable>(Entity))<br>
-      applyVariableAttributes(*Var, *Die);<br>
-    else if ((Label = dyn_cast<const DbgLabel>(Entity)))<br>
-      applyLabelAttributes(*Label, *Die);<br>
-    else<br>
-      llvm_unreachable("DbgEntity must be DbgVariable or DbgLabel.");<br>
-  }<br>
-<br>
-  if (Label) {<br>
-    const MCSymbol *Sym = Label->getSymbol();<br>
-    addLabelAddress(*Die, dwarf::DW_AT_low_pc, Sym);<br>
-  }<br>
-}<br>
-<br>
-DbgEntity *DwarfCompileUnit::getExistingAbstractEntity(const DINode *Node) {<br>
-  auto &AbstractEntities = getAbstractEntities();<br>
-  auto I = AbstractEntities.find(Node);<br>
-  if (I != AbstractEntities.end())<br>
+void DwarfCompileUnit::finishVariableDefinition(const DbgVariable &Var) {<br>
+  DbgVariable *AbsVar = getExistingAbstractVariable(<br>
+      InlinedVariable(Var.getVariable(), Var.getInlinedAt()));<br>
+  auto *VariableDie = Var.getDIE();<br>
+  if (AbsVar && AbsVar->getDIE()) {<br>
+    addDIEEntry(*VariableDie, dwarf::DW_AT_abstract_origin,<br>
+                      *AbsVar->getDIE());<br>
+  } else<br>
+    applyVariableAttributes(Var, *VariableDie);<br>
+}<br>
+<br>
+DbgVariable *DwarfCompileUnit::getExistingAbstractVariable(InlinedVariable IV) {<br>
+  const DILocalVariable *Cleansed;<br>
+  return getExistingAbstractVariable(IV, Cleansed);<br>
+}<br>
+<br>
+// Find abstract variable, if any, associated with Var.<br>
+DbgVariable *DwarfCompileUnit::getExistingAbstractVariable(<br>
+    InlinedVariable IV, const DILocalVariable *&Cleansed) {<br>
+  // More then one inlined variable corresponds to one abstract variable.<br>
+  Cleansed = IV.first;<br>
+  auto &AbstractVariables = getAbstractVariables();<br>
+  auto I = AbstractVariables.find(Cleansed);<br>
+  if (I != AbstractVariables.end())<br>
     return I->second.get();<br>
   return nullptr;<br>
 }<br>
<br>
-void DwarfCompileUnit::createAbstractEntity(const DINode *Node,<br>
-                                            LexicalScope *Scope) {<br>
+void DwarfCompileUnit::createAbstractVariable(const DILocalVariable *Var,<br>
+                                        LexicalScope *Scope) {<br>
   assert(Scope && Scope->isAbstractScope());<br>
-  auto &Entity = getAbstractEntities()[Node];<br>
-  if (isa<const DILocalVariable>(Node)) {<br>
-    Entity = llvm::make_unique<DbgVariable>(<br>
-                        cast<const DILocalVariable>(Node), nullptr /* IA */);;<br>
-    DU->addScopeVariable(Scope, cast<DbgVariable>(Entity.get()));<br>
-  } else if (isa<const DILabel>(Node)) {<br>
-    Entity = llvm::make_unique<DbgLabel>(<br>
-                        cast<const DILabel>(Node), nullptr /* IA */);<br>
-    DU->addScopeLabel(Scope, cast<DbgLabel>(Entity.get()));<br>
-  }<br>
+  auto AbsDbgVariable = llvm::make_unique<DbgVariable>(Var, /* IA */ nullptr);<br>
+  DU->addScopeVariable(Scope, AbsDbgVariable.get());<br>
+  getAbstractVariables()[Var] = std::move(AbsDbgVariable);<br>
 }<br>
<br>
 void DwarfCompileUnit::emitHeader(bool UseOffsets) {<br>
@@ -1032,15 +1005,6 @@ void DwarfCompileUnit::applyVariableAttr<br>
     addFlag(VariableDie, dwarf::DW_AT_artificial);<br>
 }<br>
<br>
-void DwarfCompileUnit::applyLabelAttributes(const DbgLabel &Label,<br>
-                                            DIE &LabelDie) {<br>
-  StringRef Name = Label.getName();<br>
-  if (!Name.empty())<br>
-    addString(LabelDie, dwarf::DW_AT_name, Name);<br>
-  const auto *DILabel = Label.getLabel();<br>
-  addSourceLine(LabelDie, DILabel);<br>
-}<br>
-<br>
 /// Add a Dwarf expression attribute data and value.<br>
 void DwarfCompileUnit::addExpr(DIELoc &Die, dwarf::Form Form,<br>
                                const MCExpr *Expr) {<br>
<br>
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h?rev=337812&r1=337811&r2=337812&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h?rev=337812&r1=337811&r2=337812&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h (original)<br>
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h Mon Jul 23 23:17:45 2018<br>
@@ -14,7 +14,7 @@<br>
 #ifndef LLVM_LIB_CODEGEN_ASMPRINTER_DWARFCOMPILEUNIT_H<br>
 #define LLVM_LIB_CODEGEN_ASMPRINTER_DWARFCOMPILEUNIT_H<br>
<br>
-#include "DbgEntityHistoryCalculator.h"<br>
+#include "DbgValueHistoryCalculator.h"<br>
 #include "DwarfDebug.h"<br>
 #include "DwarfUnit.h"<br>
 #include "llvm/ADT/ArrayRef.h"<br>
@@ -81,7 +81,7 @@ class DwarfCompileUnit final : public Dw<br>
   const MCSymbol *BaseAddress = nullptr;<br>
<br>
   DenseMap<const MDNode *, DIE *> AbstractSPDies;<br>
-  DenseMap<const DINode *, std::unique_ptr<DbgEntity>> AbstractEntities;<br>
+  DenseMap<const MDNode *, std::unique_ptr<DbgVariable>> AbstractVariables;<br>
<br>
   /// DWO ID for correlating skeleton and split units.<br>
   uint64_t DWOId = 0;<br>
@@ -98,10 +98,10 @@ class DwarfCompileUnit final : public Dw<br>
     return DU->getAbstractSPDies();<br>
   }<br>
<br>
-  DenseMap<const DINode *, std::unique_ptr<DbgEntity>> &getAbstractEntities() {<br>
+  DenseMap<const MDNode *, std::unique_ptr<DbgVariable>> &getAbstractVariables() {<br>
     if (isDwoUnit() && !DD->shareAcrossDWOCUs())<br>
-      return AbstractEntities;<br>
-    return DU->getAbstractEntities();<br>
+      return AbstractVariables;<br>
+    return DU->getAbstractVariables();<br>
   }<br>
<br>
 public:<br>
@@ -194,9 +194,6 @@ public:<br>
   DIE *constructVariableDIE(DbgVariable &DV, const LexicalScope &Scope,<br>
                             DIE *&ObjectPointer);<br>
<br>
-  /// Construct a DIE for the given DbgLabel.<br>
-  DIE *constructLabelDIE(DbgLabel &DL, const LexicalScope &Scope);<br>
-<br>
   /// A helper function to create children of a Scope DIE.<br>
   DIE *createScopeChildrenDIE(LexicalScope *Scope,<br>
                               SmallVectorImpl<DIE *> &Children,<br>
@@ -213,12 +210,14 @@ public:<br>
   DIE *constructImportedEntityDIE(const DIImportedEntity *Module);<br>
<br>
   void finishSubprogramDefinition(const DISubprogram *SP);<br>
-  void finishEntityDefinition(const DbgEntity *Entity);<br>
+  void finishVariableDefinition(const DbgVariable &Var);<br>
<br>
   /// Find abstract variable associated with Var.<br>
   using InlinedVariable = DbgValueHistoryMap::InlinedVariable;<br>
-  DbgEntity *getExistingAbstractEntity(const DINode *Node);<br>
-  void createAbstractEntity(const DINode *Node, LexicalScope *Scope);<br>
+  DbgVariable *getExistingAbstractVariable(InlinedVariable IV,<br>
+                                           const DILocalVariable *&Cleansed);<br>
+  DbgVariable *getExistingAbstractVariable(InlinedVariable IV);<br>
+  void createAbstractVariable(const DILocalVariable *Var, LexicalScope *Scope);<br>
<br>
   /// Set the skeleton unit associated with this unit.<br>
   void setSkeleton(DwarfCompileUnit &Skel) { Skeleton = &Skel; }<br>
@@ -289,8 +288,6 @@ public:<br>
   void applySubprogramAttributesToDefinition(const DISubprogram *SP,<br>
                                              DIE &SPDie);<br>
<br>
-  void applyLabelAttributes(const DbgLabel &Label, DIE &LabelDie);<br>
-<br>
   /// getRangeLists - Get the vector of range lists.<br>
   const SmallVectorImpl<RangeSpanList> &getRangeLists() const {<br>
     return (Skeleton ? Skeleton : this)->CURangeLists;<br>
<br>
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=337812&r1=337811&r2=337812&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=337812&r1=337811&r2=337812&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)<br>
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Mon Jul 23 23:17:45 2018<br>
@@ -188,12 +188,12 @@ bool DebugLocDwarfExpression::isFrameReg<br>
 }<br>
<br>
 bool DbgVariable::isBlockByrefVariable() const {<br>
-  assert(getVariable() && "Invalid complex DbgVariable!");<br>
-  return getVariable()->getType().resolve()->isBlockByrefStruct();<br>
+  assert(Var && "Invalid complex DbgVariable!");<br>
+  return Var->getType().resolve()->isBlockByrefStruct();<br>
 }<br>
<br>
 const DIType *DbgVariable::getType() const {<br>
-  DIType *Ty = getVariable()->getType().resolve();<br>
+  DIType *Ty = Var->getType().resolve();<br>
   // FIXME: isBlockByrefVariable should be reformulated in terms of complex<br>
   // addresses instead.<br>
   if (Ty->isBlockByrefStruct()) {<br>
@@ -258,8 +258,8 @@ ArrayRef<DbgVariable::FrameIndexExpr> Db<br>
 void DbgVariable::addMMIEntry(const DbgVariable &V) {<br>
   assert(DebugLocListIndex == ~0U && !MInsn && "not an MMI entry");<br>
   assert(V.DebugLocListIndex == ~0U && !V.MInsn && "not an MMI entry");<br>
-  assert(V.getVariable() == getVariable() && "conflicting variable");<br>
-  assert(V.getInlinedAt() == getInlinedAt() && "conflicting inlined-at location");<br>
+  assert(V.Var == Var && "conflicting variable");<br>
+  assert(V.IA == IA && "conflicting inlined-at location");<br>
<br>
   assert(!FrameIndexExprs.empty() && "Expected an MMI entry");<br>
   assert(!V.FrameIndexExprs.empty() && "Expected an MMI entry");<br>
@@ -726,16 +726,16 @@ void DwarfDebug::beginModule() {<br>
   }<br>
 }<br>
<br>
-void DwarfDebug::finishEntityDefinitions() {<br>
-  for (const auto &Entity : ConcreteEntities) {<br>
-    DIE *Die = Entity->getDIE();<br>
-    assert(Die);<br>
+void DwarfDebug::finishVariableDefinitions() {<br>
+  for (const auto &Var : ConcreteVariables) {<br>
+    DIE *VariableDie = Var->getDIE();<br>
+    assert(VariableDie);<br>
     // FIXME: Consider the time-space tradeoff of just storing the unit pointer<br>
-    // in the ConcreteEntities list, rather than looking it up again here.<br>
+    // in the ConcreteVariables list, rather than looking it up again here.<br>
     // DIE::getUnit isn't simple - it walks parent pointers, etc.<br>
-    DwarfCompileUnit *Unit = CUDieMap.lookup(Die->getUnitDie());<br>
+    DwarfCompileUnit *Unit = CUDieMap.lookup(VariableDie->getUnitDie());<br>
     assert(Unit);<br>
-    Unit->finishEntityDefinition(Entity.get());<br>
+    Unit->finishVariableDefinition(*Var);<br>
   }<br>
 }<br>
<br>
@@ -753,7 +753,7 @@ void DwarfDebug::finalizeModuleInfo() {<br>
<br>
   finishSubprogramDefinitions();<br>
<br>
-  finishEntityDefinitions();<br>
+  finishVariableDefinitions();<br>
<br>
   // Include the DWO file name in the hash if there's more than one CU.<br>
   // This handles ThinLTO's situation where imported CUs may very easily be<br>
@@ -910,24 +910,25 @@ void DwarfDebug::endModule() {<br>
   // FIXME: AbstractVariables.clear();<br>
 }<br>
<br>
-void DwarfDebug::ensureAbstractEntityIsCreated(DwarfCompileUnit &CU,<br>
-                                               const DINode *Node,<br>
-                                               const MDNode *ScopeNode) {<br>
-  if (CU.getExistingAbstractEntity(Node))<br>
+void DwarfDebug::ensureAbstractVariableIsCreated(DwarfCompileUnit &CU, InlinedVariable IV,<br>
+                                                 const MDNode *ScopeNode) {<br>
+  const DILocalVariable *Cleansed = nullptr;<br>
+  if (CU.getExistingAbstractVariable(IV, Cleansed))<br>
     return;<br>
<br>
-  CU.createAbstractEntity(Node, LScopes.getOrCreateAbstractScope(<br>
+  CU.createAbstractVariable(Cleansed, LScopes.getOrCreateAbstractScope(<br>
                                        cast<DILocalScope>(ScopeNode)));<br>
 }<br>
<br>
-void DwarfDebug::ensureAbstractEntityIsCreatedIfScoped(DwarfCompileUnit &CU,<br>
-    const DINode *Node, const MDNode *ScopeNode) {<br>
-  if (CU.getExistingAbstractEntity(Node))<br>
+void DwarfDebug::ensureAbstractVariableIsCreatedIfScoped(DwarfCompileUnit &CU,<br>
+    InlinedVariable IV, const MDNode *ScopeNode) {<br>
+  const DILocalVariable *Cleansed = nullptr;<br>
+  if (CU.getExistingAbstractVariable(IV, Cleansed))<br>
     return;<br>
<br>
   if (LexicalScope *Scope =<br>
           LScopes.findAbstractScope(cast_or_null<DILocalScope>(ScopeNode)))<br>
-    CU.createAbstractEntity(Node, Scope);<br>
+    CU.createAbstractVariable(Cleansed, Scope);<br>
 }<br>
<br>
 // Collect variable information from side table maintained by MF.<br>
@@ -948,14 +949,14 @@ void DwarfDebug::collectVariableInfoFrom<br>
     if (!Scope)<br>
       continue;<br>
<br>
-    ensureAbstractEntityIsCreatedIfScoped(TheCU, Var.first, Scope->getScopeNode());<br>
+    ensureAbstractVariableIsCreatedIfScoped(TheCU, Var, Scope->getScopeNode());<br>
     auto RegVar = llvm::make_unique<DbgVariable>(Var.first, Var.second);<br>
     RegVar->initializeMMI(VI.Expr, VI.Slot);<br>
     if (DbgVariable *DbgVar = MFVars.lookup(Var))<br>
       DbgVar->addMMIEntry(*RegVar);<br>
     else if (InfoHolder.addScopeVariable(Scope, RegVar.get())) {<br>
       MFVars.insert({Var, RegVar.get()});<br>
-      ConcreteEntities.push_back(std::move(RegVar));<br>
+      ConcreteVariables.push_back(std::move(RegVar));<br>
     }<br>
   }<br>
 }<br>
@@ -1120,26 +1121,14 @@ DwarfDebug::buildLocationList(SmallVecto<br>
   }<br>
 }<br>
<br>
-DbgEntity *DwarfDebug::createConcreteEntity(DwarfCompileUnit &TheCU,<br>
-                                            LexicalScope &Scope,<br>
-                                            const DINode *Node,<br>
-                                            const DILocation *Location,<br>
-                                            const MCSymbol *Sym) {<br>
-  ensureAbstractEntityIsCreatedIfScoped(TheCU, Node, Scope.getScopeNode());<br>
-  if (isa<const DILocalVariable>(Node)) {<br>
-    ConcreteEntities.push_back(<br>
-        llvm::make_unique<DbgVariable>(cast<const DILocalVariable>(Node),<br>
-                                      Location));<br>
-    InfoHolder.addScopeVariable(&Scope,<br>
-        cast<DbgVariable>(ConcreteEntities.back().get()));<br>
-  } else if (isa<const DILabel>(Node)) {<br>
-    ConcreteEntities.push_back(<br>
-        llvm::make_unique<DbgLabel>(cast<const DILabel>(Node),<br>
-                                   Location, Sym));<br>
-    InfoHolder.addScopeLabel(&Scope,<br>
-        cast<DbgLabel>(ConcreteEntities.back().get()));<br>
-  }<br>
-  return ConcreteEntities.back().get();<br>
+DbgVariable *DwarfDebug::createConcreteVariable(DwarfCompileUnit &TheCU,<br>
+                                                LexicalScope &Scope,<br>
+                                                InlinedVariable IV) {<br>
+  ensureAbstractVariableIsCreatedIfScoped(TheCU, IV, Scope.getScopeNode());<br>
+  ConcreteVariables.push_back(<br>
+      llvm::make_unique<DbgVariable>(IV.first, IV.second));<br>
+  InfoHolder.addScopeVariable(&Scope, ConcreteVariables.back().get());<br>
+  return ConcreteVariables.back().get();<br>
 }<br>
<br>
 /// Determine whether a *singular* DBG_VALUE is valid for the entirety of its<br>
@@ -1201,9 +1190,9 @@ static bool validThroughout(LexicalScope<br>
 }<br>
<br>
 // Find variables for each lexical scope.<br>
-void DwarfDebug::collectEntityInfo(DwarfCompileUnit &TheCU,<br>
-                                   const DISubprogram *SP,<br>
-                                   DenseSet<InlinedVariable> &Processed) {<br>
+void DwarfDebug::collectVariableInfo(DwarfCompileUnit &TheCU,<br>
+                                     const DISubprogram *SP,<br>
+                                     DenseSet<InlinedVariable> &Processed) {<br>
   // Grab the variable info that was squirreled away in the MMI side-table.<br>
   collectVariableInfoFromMFTable(TheCU, Processed);<br>
<br>
@@ -1227,8 +1216,7 @@ void DwarfDebug::collectEntityInfo(Dwarf<br>
       continue;<br>
<br>
     Processed.insert(IV);<br>
-    DbgVariable *RegVar = cast<DbgVariable>(createConcreteEntity(TheCU,<br>
-                                             *Scope, IV.first, IV.second));<br>
+    DbgVariable *RegVar = createConcreteVariable(TheCU, *Scope, IV);<br>
<br>
     const MachineInstr *MInsn = Ranges.front().first;<br>
     assert(MInsn->isDebugValue() && "History must begin with debug value");<br>
@@ -1261,44 +1249,13 @@ void DwarfDebug::collectEntityInfo(Dwarf<br>
       Entry.finalize(*Asm, List, BT);<br>
   }<br>
<br>
-  // For each InlinedLabel collected from DBG_LABEL instructions, convert to<br>
-  // DWARF-related DbgLabel.<br>
-  for (const auto &I : DbgLabels) {<br>
-    InlinedLabel IL = I.first;<br>
-    const MachineInstr *MI = I.second;<br>
-    if (MI == nullptr)<br>
-      continue;<br>
-<br>
-    LexicalScope *Scope = nullptr;<br>
-    // Get inlined DILocation if it is inlined label.<br>
-    if (const DILocation *IA = IL.second)<br>
-      Scope = LScopes.findInlinedScope(IL.first->getScope(), IA);<br>
-    else<br>
-      Scope = LScopes.findLexicalScope(IL.first->getScope());<br>
-    // If label scope is not found then skip this label.<br>
-    if (!Scope)<br>
-      continue;<br>
-<br>
-    /// At this point, the temporary label is created.<br>
-    /// Save the temporary label to DbgLabel entity to get the<br>
-    /// actually address when generating Dwarf DIE.<br>
-    MCSymbol *Sym = getLabelBeforeInsn(MI);<br>
-    createConcreteEntity(TheCU, *Scope, IL.first, IL.second, Sym);<br>
-  }<br>
-<br>
-  // Collect info for variables/labels that were optimized out.<br>
+  // Collect info for variables that were optimized out.<br>
   for (const DINode *DN : SP->getRetainedNodes()) {<br>
-    LexicalScope *Scope = nullptr;<br>
     if (auto *DV = dyn_cast<DILocalVariable>(DN)) {<br>
-      if (!Processed.insert(InlinedVariable(DV, nullptr)).second)<br>
-       continue;<br>
-      Scope = LScopes.findLexicalScope(DV->getScope());<br>
-    } else if (auto *DL = dyn_cast<DILabel>(DN)) {<br>
-      Scope = LScopes.findLexicalScope(DL->getScope());<br>
+      if (Processed.insert(InlinedVariable(DV, nullptr)).second)<br>
+        if (LexicalScope *Scope = LScopes.findLexicalScope(DV->getScope()))<br>
+          createConcreteVariable(TheCU, *Scope, InlinedVariable(DV, nullptr));<br>
     }<br>
-<br>
-    if (Scope)<br>
-      createConcreteEntity(TheCU, *Scope, DN, nullptr);<br>
   }<br>
 }<br>
<br>
@@ -1456,7 +1413,7 @@ void DwarfDebug::endFunctionImpl(const M<br>
   DwarfCompileUnit &TheCU = *CUMap.lookup(SP->getUnit());<br>
<br>
   DenseSet<InlinedVariable> ProcessedVars;<br>
-  collectEntityInfo(TheCU, SP, ProcessedVars);<br>
+  collectVariableInfo(TheCU, SP, ProcessedVars);<br>
<br>
   // Add the range of this function to the list of ranges for the CU.<br>
   TheCU.addRange(RangeSpan(Asm->getFunctionBegin(), Asm->getFunctionEnd()));<br>
@@ -1484,11 +1441,10 @@ void DwarfDebug::endFunctionImpl(const M<br>
         // Collect info for variables that were optimized out.<br>
         if (!ProcessedVars.insert(InlinedVariable(DV, nullptr)).second)<br>
           continue;<br>
-        ensureAbstractEntityIsCreated(TheCU, DV, DV->getScope());<br>
+        ensureAbstractVariableIsCreated(TheCU, InlinedVariable(DV, nullptr),<br>
+                                        DV->getScope());<br>
         assert(LScopes.getAbstractScopesList().size() == NumAbstractScopes<br>
-               && "ensureAbstractEntityIsCreated inserted abstract scopes");<br>
-      } else if (auto *DL = dyn_cast<DILabel>(DN)) {<br>
-        ensureAbstractEntityIsCreated(TheCU, DL, DL->getScope());<br>
+               && "ensureAbstractVariableIsCreated inserted abstract scopes");<br>
       }<br>
     }<br>
     constructAbstractSubprogramScopeDIE(TheCU, AScope);<br>
@@ -1506,7 +1462,6 @@ void DwarfDebug::endFunctionImpl(const M<br>
   // DbgVariables except those that are also in AbstractVariables (since they<br>
   // can be used cross-function)<br>
   InfoHolder.getScopeVariables().clear();<br>
-  InfoHolder.getScopeLabels().clear();<br>
   PrevLabel = nullptr;<br>
   CurFn = nullptr;<br>
 }<br>
<br>
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h?rev=337812&r1=337811&r2=337812&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h?rev=337812&r1=337811&r2=337812&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h (original)<br>
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h Mon Jul 23 23:17:45 2018<br>
@@ -15,7 +15,7 @@<br>
 #define LLVM_LIB_CODEGEN_ASMPRINTER_DWARFDEBUG_H<br>
<br>
 #include "AddressPool.h"<br>
-#include "DbgEntityHistoryCalculator.h"<br>
+#include "DbgValueHistoryCalculator.h"<br>
 #include "DebugHandlerBase.h"<br>
 #include "DebugLocStream.h"<br>
 #include "DwarfFile.h"<br>
@@ -62,46 +62,6 @@ class MDNode;<br>
 class Module;<br>
<br>
 //===----------------------------------------------------------------------===//<br>
-/// This class is defined as the common parent of DbgVariable and DbgLabel<br>
-/// such that it could levarage polymorphism to extract common code for<br>
-/// DbgVariable and DbgLabel.<br>
-class DbgEntity {<br>
-  const DINode *Entity;<br>
-  const DILocation *InlinedAt;<br>
-  DIE *TheDIE = nullptr;<br>
-  unsigned SubclassID;<br>
-<br>
-public:<br>
-  enum DbgEntityKind {<br>
-    DbgVariableKind,<br>
-    DbgLabelKind<br>
-  };<br>
-<br>
-  DbgEntity(const DINode *N, const DILocation *IA, unsigned ID)<br>
-    : Entity(N), InlinedAt(IA), SubclassID(ID) {}<br>
-<br>
-  /// Accessors.<br>
-  /// @{<br>
-  const DINode *getEntity() const { return Entity; }<br>
-  const DILocation *getInlinedAt() const { return InlinedAt; }<br>
-  DIE *getDIE() const { return TheDIE; }<br>
-  unsigned getDbgEntityID() const { return SubclassID; }<br>
-  /// @}<br>
-<br>
-  void setDIE(DIE &D) { TheDIE = &D; }<br>
-<br>
-  static bool classof(const DbgEntity *N) {<br>
-    switch (N->getDbgEntityID()) {<br>
-    default:<br>
-      return false;<br>
-    case DbgVariableKind:<br>
-    case DbgLabelKind:<br>
-      return true;<br>
-    }<br>
-  }<br>
-};<br>
-<br>
-//===----------------------------------------------------------------------===//<br>
 /// This class is used to track local variable information.<br>
 ///<br>
 /// Variables can be created from allocas, in which case they're generated from<br>
@@ -113,7 +73,10 @@ public:<br>
 /// single instruction use \a MInsn and (optionally) a single entry of \a Expr.<br>
 ///<br>
 /// Variables that have been optimized out use none of these fields.<br>
-class DbgVariable : public DbgEntity {<br>
+class DbgVariable {<br>
+  const DILocalVariable *Var;                /// Variable Descriptor.<br>
+  const DILocation *IA;                      /// Inlined at location.<br>
+  DIE *TheDIE = nullptr;                     /// Variable DIE.<br>
   unsigned DebugLocListIndex = ~0u;          /// Offset in DebugLocs.<br>
   const MachineInstr *MInsn = nullptr;       /// DBG_VALUE instruction.<br>
<br>
@@ -130,7 +93,7 @@ public:<br>
   /// Creates a variable without any DW_AT_location.  Call \a initializeMMI()<br>
   /// for MMI entries, or \a initializeDbgValue() for DBG_VALUE instructions.<br>
   DbgVariable(const DILocalVariable *V, const DILocation *IA)<br>
-      : DbgEntity(V, IA, DbgVariableKind) {}<br>
+      : Var(V), IA(IA) {}<br>
<br>
   /// Initialize from the MMI table.<br>
   void initializeMMI(const DIExpression *E, int FI) {<br>
@@ -148,9 +111,8 @@ public:<br>
     assert(FrameIndexExprs.empty() && "Already initialized?");<br>
     assert(!MInsn && "Already initialized?");<br>
<br>
-    assert(getVariable() == DbgValue->getDebugVariable() && "Wrong variable");<br>
-    assert(getInlinedAt() == DbgValue->getDebugLoc()->getInlinedAt() &&<br>
-           "Wrong inlined-at");<br>
+    assert(Var == DbgValue->getDebugVariable() && "Wrong variable");<br>
+    assert(IA == DbgValue->getDebugLoc()->getInlinedAt() && "Wrong inlined-at");<br>
<br>
     MInsn = DbgValue;<br>
     if (auto *E = DbgValue->getDebugExpression())<br>
@@ -159,18 +121,19 @@ public:<br>
   }<br>
<br>
   // Accessors.<br>
-  const DILocalVariable *getVariable() const {<br>
-    return cast<DILocalVariable>(getEntity());<br>
-  }<br>
+  const DILocalVariable *getVariable() const { return Var; }<br>
+  const DILocation *getInlinedAt() const { return IA; }<br>
<br>
   const DIExpression *getSingleExpression() const {<br>
     assert(MInsn && FrameIndexExprs.size() <= 1);<br>
     return FrameIndexExprs.size() ? FrameIndexExprs[0].Expr : nullptr;<br>
   }<br>
<br>
+  void setDIE(DIE &D) { TheDIE = &D; }<br>
+  DIE *getDIE() const { return TheDIE; }<br>
   void setDebugLocListIndex(unsigned O) { DebugLocListIndex = O; }<br>
   unsigned getDebugLocListIndex() const { return DebugLocListIndex; }<br>
-  StringRef getName() const { return getVariable()->getName(); }<br>
+  StringRef getName() const { return Var->getName(); }<br>
   const MachineInstr *getMInsn() const { return MInsn; }<br>
   /// Get the FI entries, sorted by fragment offset.<br>
   ArrayRef<FrameIndexExpr> getFrameIndexExprs() const;<br>
@@ -180,7 +143,7 @@ public:<br>
   // Translate tag to proper Dwarf tag.<br>
   dwarf::Tag getTag() const {<br>
     // FIXME: Why don't we just infer this tag and store it all along?<br>
-    if (getVariable()->isParameter())<br>
+    if (Var->isParameter())<br>
       return dwarf::DW_TAG_formal_parameter;<br>
<br>
     return dwarf::DW_TAG_variable;<br>
@@ -188,7 +151,7 @@ public:<br>
<br>
   /// Return true if DbgVariable is artificial.<br>
   bool isArtificial() const {<br>
-    if (getVariable()->isArtificial())<br>
+    if (Var->isArtificial())<br>
       return true;<br>
     if (getType()->isArtificial())<br>
       return true;<br>
@@ -196,7 +159,7 @@ public:<br>
   }<br>
<br>
   bool isObjectPointer() const {<br>
-    if (getVariable()->isObjectPointer())<br>
+    if (Var->isObjectPointer())<br>
       return true;<br>
     if (getType()->isObjectPointer())<br>
       return true;<br>
@@ -215,45 +178,6 @@ public:<br>
   bool isBlockByrefVariable() const;<br>
   const DIType *getType() const;<br>
<br>
-  static bool classof(const DbgEntity *N) {<br>
-    return N->getDbgEntityID() == DbgVariableKind;<br>
-  }<br>
-<br>
-private:<br>
-  template <typename T> T *resolve(TypedDINodeRef<T> Ref) const {<br>
-    return Ref.resolve();<br>
-  }<br>
-};<br>
-<br>
-//===----------------------------------------------------------------------===//<br>
-/// This class is used to track label information.<br>
-///<br>
-/// Labels are collected from \c DBG_LABEL instructions.<br>
-class DbgLabel : public DbgEntity {<br>
-  const MCSymbol *Sym;                  /// Symbol before DBG_LABEL instruction.<br>
-<br>
-public:<br>
-  /// We need MCSymbol information to generate DW_AT_low_pc.<br>
-  DbgLabel(const DILabel *L, const DILocation *IA, const MCSymbol *Sym = nullptr)<br>
-      : DbgEntity(L, IA, DbgLabelKind), Sym(Sym) {}<br>
-<br>
-  /// Accessors.<br>
-  /// @{<br>
-  const DILabel *getLabel() const { return cast<DILabel>(getEntity()); }<br>
-  const MCSymbol *getSymbol() const { return Sym; }<br>
-<br>
-  StringRef getName() const { return getLabel()->getName(); }<br>
-  /// @}<br>
-<br>
-  /// Translate tag to proper Dwarf tag.<br>
-  dwarf::Tag getTag() const {<br>
-    return dwarf::DW_TAG_label;<br>
-  }<br>
-<br>
-  static bool classof(const DbgEntity *N) {<br>
-    return N->getDbgEntityID() == DbgLabelKind;<br>
-  }<br>
-<br>
 private:<br>
   template <typename T> T *resolve(TypedDINodeRef<T> Ref) const {<br>
     return Ref.resolve();<br>
@@ -293,8 +217,8 @@ class DwarfDebug : public DebugHandlerBa<br>
   /// Size of each symbol emitted (for those symbols that have a specific size).<br>
   DenseMap<const MCSymbol *, uint64_t> SymSize;<br>
<br>
-  /// Collection of abstract variables/labels.<br>
-  SmallVector<std::unique_ptr<DbgEntity>, 64> ConcreteEntities;<br>
+  /// Collection of abstract variables.<br>
+  SmallVector<std::unique_ptr<DbgVariable>, 64> ConcreteVariables;<br>
<br>
   /// Collection of DebugLocEntry. Stored in a linked list so that DIELocLists<br>
   /// can refer to them in spite of insertions into this list.<br>
@@ -409,20 +333,14 @@ class DwarfDebug : public DebugHandlerBa<br>
   }<br>
<br>
   using InlinedVariable = DbgValueHistoryMap::InlinedVariable;<br>
-  using InlinedLabel = DbgLabelInstrMap::InlinedLabel;<br>
<br>
-  void ensureAbstractEntityIsCreated(DwarfCompileUnit &CU,<br>
-                                     const DINode *Node,<br>
-                                     const MDNode *Scope);<br>
-  void ensureAbstractEntityIsCreatedIfScoped(DwarfCompileUnit &CU,<br>
-                                             const DINode *Node,<br>
-                                             const MDNode *Scope);<br>
-<br>
-  DbgEntity *createConcreteEntity(DwarfCompileUnit &TheCU,<br>
-                                  LexicalScope &Scope,<br>
-                                  const DINode *Node,<br>
-                                  const DILocation *Location,<br>
-                                  const MCSymbol *Sym = nullptr);<br>
+  void ensureAbstractVariableIsCreated(DwarfCompileUnit &CU, InlinedVariable IV,<br>
+                                       const MDNode *Scope);<br>
+  void ensureAbstractVariableIsCreatedIfScoped(DwarfCompileUnit &CU, InlinedVariable IV,<br>
+                                               const MDNode *Scope);<br>
+<br>
+  DbgVariable *createConcreteVariable(DwarfCompileUnit &TheCU,<br>
+                                      LexicalScope &Scope, InlinedVariable IV);<br>
<br>
   /// Construct a DIE for this abstract scope.<br>
   void constructAbstractSubprogramScopeDIE(DwarfCompileUnit &SrcCU, LexicalScope *Scope);<br>
@@ -431,7 +349,7 @@ class DwarfDebug : public DebugHandlerBa<br>
   void addAccelNameImpl(AccelTable<DataT> &AppleAccel, StringRef Name,<br>
                         const DIE &Die);<br>
<br>
-  void finishEntityDefinitions();<br>
+  void finishVariableDefinitions();<br>
<br>
   void finishSubprogramDefinitions();<br>
<br>
@@ -543,8 +461,8 @@ class DwarfDebug : public DebugHandlerBa<br>
                         unsigned Flags);<br>
<br>
   /// Populate LexicalScope entries with variables' info.<br>
-  void collectEntityInfo(DwarfCompileUnit &TheCU, const DISubprogram *SP,<br>
-                         DenseSet<InlinedVariable> &ProcessedVars);<br>
+  void collectVariableInfo(DwarfCompileUnit &TheCU, const DISubprogram *SP,<br>
+                           DenseSet<InlinedVariable> &ProcessedVars);<br>
<br>
   /// Build the location list for all DBG_VALUEs in the<br>
   /// function that describe the same variable.<br>
<br>
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfFile.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfFile.cpp?rev=337812&r1=337811&r2=337812&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfFile.cpp?rev=337812&r1=337811&r2=337812&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfFile.cpp (original)<br>
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfFile.cpp Mon Jul 23 23:17:45 2018<br>
@@ -118,8 +118,3 @@ bool DwarfFile::addScopeVariable(Lexical<br>
   }    <br>
   return true;<br>
 }<br>
-<br>
-void DwarfFile::addScopeLabel(LexicalScope *LS, DbgLabel *Label) {<br>
-  SmallVectorImpl<DbgLabel *> &Labels = ScopeLabels[LS];<br>
-  Labels.push_back(Label);<br>
-}<br>
<br>
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfFile.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfFile.h?rev=337812&r1=337811&r2=337812&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfFile.h?rev=337812&r1=337811&r2=337812&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfFile.h (original)<br>
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfFile.h Mon Jul 23 23:17:45 2018<br>
@@ -24,9 +24,7 @@<br>
 namespace llvm {<br>
<br>
 class AsmPrinter;<br>
-class DbgEntity;<br>
 class DbgVariable;<br>
-class DbgLabel;<br>
 class DwarfCompileUnit;<br>
 class DwarfUnit;<br>
 class LexicalScope;<br>
@@ -64,13 +62,9 @@ class DwarfFile {<br>
   /// Collection of DbgVariables of each lexical scope.<br>
   DenseMap<LexicalScope *, ScopeVars> ScopeVariables;<br>
<br>
-  /// Collection of DbgLabels of each lexical scope.<br>
-  using LabelList = SmallVector<DbgLabel *, 4>;<br>
-  DenseMap<LexicalScope *, LabelList> ScopeLabels;<br>
-<br>
   // Collection of abstract subprogram DIEs.<br>
   DenseMap<const MDNode *, DIE *> AbstractSPDies;<br>
-  DenseMap<const DINode *, std::unique_ptr<DbgEntity>> AbstractEntities;<br>
+  DenseMap<const MDNode *, std::unique_ptr<DbgVariable>> AbstractVariables</blockquote></div>