[llvm] r204162 - Debug info: Remove OdrMemberMap from DwarfDebug, it's not necessary.

Adrian Prantl aprantl at apple.com
Tue Mar 18 10:41:15 PDT 2014


Author: adrian
Date: Tue Mar 18 12:41:15 2014
New Revision: 204162

URL: http://llvm.org/viewvc/llvm-project?rev=204162&view=rev
Log:
Debug info: Remove OdrMemberMap from DwarfDebug, it's not necessary.
Follow-up to r203982.

Modified:
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=204162&r1=204161&r2=204162&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Tue Mar 18 12:41:15 2014
@@ -369,7 +369,6 @@ bool DwarfDebug::isSubprogramContext(con
 // scope then create and insert DIEs for these variables.
 DIE *DwarfDebug::updateSubprogramScopeDIE(DwarfCompileUnit *SPCU,
                                           DISubprogram SP) {
-  SP = SPCU->getOdrUniqueSubprogram(resolve(SP.getContext()), SP);
   DIE *SPDie = SPCU->getDIE(SP);
 
   assert(SPDie && "Unable to find subprogram DIE!");
@@ -604,7 +603,8 @@ DIE *DwarfDebug::constructScopeDIE(Dwarf
   if (!Scope || !Scope->getScopeNode())
     return NULL;
 
-  DIScope DS(Scope->getScopeNode());
+  // Unique scope where applicable.
+  DIScope DS(resolve(DIScope(Scope->getScopeNode()).getRef()));
 
   SmallVector<DIE *, 8> Children;
   DIE *ObjectPointer = NULL;

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h?rev=204162&r1=204161&r2=204162&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h Tue Mar 18 12:41:15 2014
@@ -346,9 +346,6 @@ class DwarfDebug : public AsmPrinterHand
   /// of in DwarfCompileUnit.
   DenseMap<const MDNode *, DIE *> MDTypeNodeToDieMap;
 
-  // Used to unique C++ member function declarations.
-  StringMap<const MDNode *> OdrMemberMap;
-
   // List of all labels used in aranges generation.
   std::vector<SymbolCU> ArangeLabels;
 
@@ -700,11 +697,6 @@ public:
     return MDTypeNodeToDieMap.lookup(TypeMD);
   }
 
-  /// \brief Look up or create an entry in the OdrMemberMap.
-  const MDNode *&getOrCreateOdrMember(StringRef Key) {
-    return OdrMemberMap.GetOrCreateValue(Key).getValue();
-  }
-
   /// \brief Emit all Dwarf sections that should come prior to the
   /// content.
   void beginModule();

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp?rev=204162&r1=204161&r2=204162&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp Tue Mar 18 12:41:15 2014
@@ -1427,24 +1427,6 @@ DIE *DwarfUnit::getOrCreateNameSpace(DIN
   return NDie;
 }
 
-/// Unique C++ member function declarations based on their
-/// context and mangled name.
-DISubprogram
-DwarfUnit::getOdrUniqueSubprogram(DIScope Context, DISubprogram SP) const {
-  if (!hasODR() ||
-      !Context.isCompositeType() ||
-      SP.getLinkageName().empty() ||
-      SP.isDefinition())
-    return SP;
-  // Create a key with the UID of the parent class and this SP's name.
-  Twine Key = SP.getContext().getName() + SP.getLinkageName();
-  const MDNode *&Entry = DD->getOrCreateOdrMember(Key.str());
-  if (!Entry)
-    Entry = &*SP;
-
-  return DISubprogram(Entry);
-}
-
 /// getOrCreateSubprogramDIE - Create new DIE using SP.
 DIE *DwarfUnit::getOrCreateSubprogramDIE(DISubprogram SP) {
   // Construct the context before querying for the existence of the DIE in case
@@ -1452,8 +1434,10 @@ DIE *DwarfUnit::getOrCreateSubprogramDIE
   // declarations).
   DIScope Context = resolve(SP.getContext());
   DIE *ContextDIE = getOrCreateContextDIE(Context);
+
   // Unique declarations based on the ODR, where applicable.
-  SP = getOdrUniqueSubprogram(Context, SP);
+  SP = DISubprogram(DD->resolve(SP.getRef()));
+  assert(SP.Verify());
 
   DIE *SPDie = getDIE(SP);
   if (SPDie)

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h?rev=204162&r1=204161&r2=204162&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h Tue Mar 18 12:41:15 2014
@@ -487,28 +487,6 @@ public:
 
   virtual DwarfCompileUnit &getCU() = 0;
 
-  /// \brief Return whether this compilation unit has the
-  /// one-definition-rule (ODR).  In C++ this allows the compiler to
-  /// perform type unique during LTO.
-  bool hasODR() const {
-    switch (getLanguage()) {
-    case dwarf::DW_LANG_C_plus_plus:
-    case dwarf::DW_LANG_C_plus_plus_03:
-    case dwarf::DW_LANG_C_plus_plus_11:
-      // For all we care, the C++ part of the language has the ODR and
-      // ObjC methods are not represented in a way that they could be
-      // confused with C++ member functions.
-    case dwarf::DW_LANG_ObjC_plus_plus:
-      return true;
-    default:
-      return false;
-    }
-  }
-
-  /// \brief Unique C++ member function declarations based on their
-  /// context+mangled name.
-  DISubprogram getOdrUniqueSubprogram(DIScope Context, DISubprogram SP) const;
-
 protected:
   /// getOrCreateStaticMemberDIE - Create new static data member DIE.
   DIE *getOrCreateStaticMemberDIE(DIDerivedType DT);





More information about the llvm-commits mailing list