IR: Give 'DI' prefix to debug info metadata
Finish off PR23080 by renaming the debug info IR constructs from `MD*`
to `DI*`.  The last of the `DIDescriptor` classes were deleted in
r235356, and the last of the related typedefs removed in r235413, so
this has all baked for about a week.
Note: If you have out-of-tree code (like a frontend), I recommend that
you get everything compiling and tests passing with the *previous*
commit before updating to this one.  It'll be easier to keep track of
what code is using the `DIDescriptor` hierarchy and what you've already
updated, and I think you're extremely unlikely to insert bugs.  YMMV of
course.
Back to *this* commit: I did this using the rename-md-di-nodes.sh
upgrade script I've attached to PR23080 (both code and testcases) and
filtered through clang-format-diff.py.  I edited the tests for
test/Assembler/invalid-generic-debug-node-*.ll by hand since the columns
were off-by-three.  It should work on your out-of-tree testcases (and
code, if you've followed the advice in the previous paragraph).
Some of the tests are in badly named files now (e.g.,
test/Assembler/invalid-mdcompositetype-missing-tag.ll should be
'dicompositetype'); I'll come back and move the files in a follow-up
commit.
llvm-svn: 236120
diff --git a/llvm/include/llvm/CodeGen/LexicalScopes.h b/llvm/include/llvm/CodeGen/LexicalScopes.h
index aa217d5..7d7e48a 100644
--- a/llvm/include/llvm/CodeGen/LexicalScopes.h
+++ b/llvm/include/llvm/CodeGen/LexicalScopes.h
@@ -45,7 +45,7 @@
 class LexicalScope {
 
 public:
-  LexicalScope(LexicalScope *P, const MDLocalScope *D, const MDLocation *I,
+  LexicalScope(LexicalScope *P, const DILocalScope *D, const DILocation *I,
                bool A)
       : Parent(P), Desc(D), InlinedAtLocation(I), AbstractScope(A),
         LastInsn(nullptr), FirstInsn(nullptr), DFSIn(0), DFSOut(0) {
@@ -58,8 +58,8 @@
   // Accessors.
   LexicalScope *getParent() const { return Parent; }
   const MDNode *getDesc() const { return Desc; }
-  const MDLocation *getInlinedAt() const { return InlinedAtLocation; }
-  const MDLocalScope *getScopeNode() const { return Desc; }
+  const DILocation *getInlinedAt() const { return InlinedAtLocation; }
+  const DILocalScope *getScopeNode() const { return Desc; }
   bool isAbstractScope() const { return AbstractScope; }
   SmallVectorImpl<LexicalScope *> &getChildren() { return Children; }
   SmallVectorImpl<InsnRange> &getRanges() { return Ranges; }
@@ -119,8 +119,8 @@
 
 private:
   LexicalScope *Parent;                        // Parent to this scope.
-  const MDLocalScope *Desc;                    // Debug info descriptor.
-  const MDLocation *InlinedAtLocation;         // Location at which this
+  const DILocalScope *Desc;                    // Debug info descriptor.
+  const DILocation *InlinedAtLocation;         // Location at which this
                                                // scope is inlined.
   bool AbstractScope;                          // Abstract Scope
   SmallVector<LexicalScope *, 4> Children;     // Scopes defined in scope.
@@ -159,16 +159,16 @@
   /// getMachineBasicBlocks - Populate given set using machine basic blocks
   /// which have machine instructions that belong to lexical scope identified by
   /// DebugLoc.
-  void getMachineBasicBlocks(const MDLocation *DL,
+  void getMachineBasicBlocks(const DILocation *DL,
                              SmallPtrSetImpl<const MachineBasicBlock *> &MBBs);
 
   /// dominates - Return true if DebugLoc's lexical scope dominates at least one
   /// machine instruction's lexical scope in a given machine basic block.
-  bool dominates(const MDLocation *DL, MachineBasicBlock *MBB);
+  bool dominates(const DILocation *DL, MachineBasicBlock *MBB);
 
   /// findLexicalScope - Find lexical scope, either regular or inlined, for the
   /// given DebugLoc. Return NULL if not found.
-  LexicalScope *findLexicalScope(const MDLocation *DL);
+  LexicalScope *findLexicalScope(const DILocation *DL);
 
   /// getAbstractScopesList - Return a reference to list of abstract scopes.
   ArrayRef<LexicalScope *> getAbstractScopesList() const {
@@ -176,19 +176,19 @@
   }
 
   /// findAbstractScope - Find an abstract scope or return null.
-  LexicalScope *findAbstractScope(const MDLocalScope *N) {
+  LexicalScope *findAbstractScope(const DILocalScope *N) {
     auto I = AbstractScopeMap.find(N);
     return I != AbstractScopeMap.end() ? &I->second : nullptr;
   }
 
   /// findInlinedScope - Find an inlined scope for the given scope/inlined-at.
-  LexicalScope *findInlinedScope(const MDLocalScope *N, const MDLocation *IA) {
+  LexicalScope *findInlinedScope(const DILocalScope *N, const DILocation *IA) {
     auto I = InlinedLexicalScopeMap.find(std::make_pair(N, IA));
     return I != InlinedLexicalScopeMap.end() ? &I->second : nullptr;
   }
 
   /// findLexicalScope - Find regular lexical scope or return null.
-  LexicalScope *findLexicalScope(const MDLocalScope *N) {
+  LexicalScope *findLexicalScope(const DILocalScope *N) {
     auto I = LexicalScopeMap.find(N);
     return I != LexicalScopeMap.end() ? &I->second : nullptr;
   }
@@ -197,24 +197,24 @@
   void dump();
 
   /// getOrCreateAbstractScope - Find or create an abstract lexical scope.
-  LexicalScope *getOrCreateAbstractScope(const MDLocalScope *Scope);
+  LexicalScope *getOrCreateAbstractScope(const DILocalScope *Scope);
 
 private:
   /// getOrCreateLexicalScope - Find lexical scope for the given Scope/IA. If
   /// not available then create new lexical scope.
-  LexicalScope *getOrCreateLexicalScope(const MDLocalScope *Scope,
-                                        const MDLocation *IA = nullptr);
-  LexicalScope *getOrCreateLexicalScope(const MDLocation *DL) {
+  LexicalScope *getOrCreateLexicalScope(const DILocalScope *Scope,
+                                        const DILocation *IA = nullptr);
+  LexicalScope *getOrCreateLexicalScope(const DILocation *DL) {
     return DL ? getOrCreateLexicalScope(DL->getScope(), DL->getInlinedAt())
               : nullptr;
   }
 
   /// getOrCreateRegularScope - Find or create a regular lexical scope.
-  LexicalScope *getOrCreateRegularScope(const MDLocalScope *Scope);
+  LexicalScope *getOrCreateRegularScope(const DILocalScope *Scope);
 
   /// getOrCreateInlinedScope - Find or create an inlined lexical scope.
-  LexicalScope *getOrCreateInlinedScope(const MDLocalScope *Scope,
-                                        const MDLocation *InlinedAt);
+  LexicalScope *getOrCreateInlinedScope(const DILocalScope *Scope,
+                                        const DILocation *InlinedAt);
 
   /// extractLexicalScopes - Extract instruction ranges for each lexical scopes
   /// for the given machine function.
@@ -230,18 +230,18 @@
 
   /// LexicalScopeMap - Tracks the scopes in the current function.
   // Use an unordered_map to ensure value pointer validity over insertion.
-  std::unordered_map<const MDLocalScope *, LexicalScope> LexicalScopeMap;
+  std::unordered_map<const DILocalScope *, LexicalScope> LexicalScopeMap;
 
   /// InlinedLexicalScopeMap - Tracks inlined function scopes in current
   /// function.
-  std::unordered_map<std::pair<const MDLocalScope *, const MDLocation *>,
+  std::unordered_map<std::pair<const DILocalScope *, const DILocation *>,
                      LexicalScope,
-                     pair_hash<const MDLocalScope *, const MDLocation *>>
+                     pair_hash<const DILocalScope *, const DILocation *>>
       InlinedLexicalScopeMap;
 
   /// AbstractScopeMap - These scopes are  not included LexicalScopeMap.
   // Use an unordered_map to ensure value pointer validity over insertion.
-  std::unordered_map<const MDLocalScope *, LexicalScope> AbstractScopeMap;
+  std::unordered_map<const DILocalScope *, LexicalScope> AbstractScopeMap;
 
   /// AbstractScopesList - Tracks abstract scopes constructed while processing
   /// a function.
diff --git a/llvm/include/llvm/CodeGen/MachineInstr.h b/llvm/include/llvm/CodeGen/MachineInstr.h
index 5a28c1b..586ac04 100644
--- a/llvm/include/llvm/CodeGen/MachineInstr.h
+++ b/llvm/include/llvm/CodeGen/MachineInstr.h
@@ -246,16 +246,16 @@
 
   /// \brief Return the debug variable referenced by
   /// this DBG_VALUE instruction.
-  const MDLocalVariable *getDebugVariable() const {
+  const DILocalVariable *getDebugVariable() const {
     assert(isDebugValue() && "not a DBG_VALUE");
-    return cast<MDLocalVariable>(getOperand(2).getMetadata());
+    return cast<DILocalVariable>(getOperand(2).getMetadata());
   }
 
   /// \brief Return the complex address expression referenced by
   /// this DBG_VALUE instruction.
-  const MDExpression *getDebugExpression() const {
+  const DIExpression *getDebugExpression() const {
     assert(isDebugValue() && "not a DBG_VALUE");
-    return cast<MDExpression>(getOperand(3).getMetadata());
+    return cast<DIExpression>(getOperand(3).getMetadata());
   }
 
   /// emitError - Emit an error referring to the source location of this
diff --git a/llvm/include/llvm/CodeGen/MachineInstrBuilder.h b/llvm/include/llvm/CodeGen/MachineInstrBuilder.h
index 8825452..47397c6 100644
--- a/llvm/include/llvm/CodeGen/MachineInstrBuilder.h
+++ b/llvm/include/llvm/CodeGen/MachineInstrBuilder.h
@@ -356,9 +356,9 @@
                                    const MCInstrDesc &MCID, bool IsIndirect,
                                    unsigned Reg, unsigned Offset,
                                    const MDNode *Variable, const MDNode *Expr) {
-  assert(isa<MDLocalVariable>(Variable) && "not a variable");
-  assert(cast<MDExpression>(Expr)->isValid() && "not an expression");
-  assert(cast<MDLocalVariable>(Variable)->isValidLocationForIntrinsic(DL) &&
+  assert(isa<DILocalVariable>(Variable) && "not a variable");
+  assert(cast<DIExpression>(Expr)->isValid() && "not an expression");
+  assert(cast<DILocalVariable>(Variable)->isValidLocationForIntrinsic(DL) &&
          "Expected inlined-at fields to agree");
   if (IsIndirect)
     return BuildMI(MF, DL, MCID)
@@ -385,8 +385,8 @@
                                    const MCInstrDesc &MCID, bool IsIndirect,
                                    unsigned Reg, unsigned Offset,
                                    const MDNode *Variable, const MDNode *Expr) {
-  assert(isa<MDLocalVariable>(Variable) && "not a variable");
-  assert(cast<MDExpression>(Expr)->isValid() && "not an expression");
+  assert(isa<DILocalVariable>(Variable) && "not a variable");
+  assert(cast<DIExpression>(Expr)->isValid() && "not an expression");
   MachineFunction &MF = *BB.getParent();
   MachineInstr *MI =
       BuildMI(MF, DL, MCID, IsIndirect, Reg, Offset, Variable, Expr);
diff --git a/llvm/include/llvm/CodeGen/MachineModuleInfo.h b/llvm/include/llvm/CodeGen/MachineModuleInfo.h
index d53fdd4..ce45c16 100644
--- a/llvm/include/llvm/CodeGen/MachineModuleInfo.h
+++ b/llvm/include/llvm/CodeGen/MachineModuleInfo.h
@@ -193,13 +193,13 @@
   static char ID; // Pass identification, replacement for typeid
 
   struct VariableDbgInfo {
-    const MDLocalVariable *Var;
-    const MDExpression *Expr;
+    const DILocalVariable *Var;
+    const DIExpression *Expr;
     unsigned Slot;
-    const MDLocation *Loc;
+    const DILocation *Loc;
 
-    VariableDbgInfo(const MDLocalVariable *Var, const MDExpression *Expr,
-                    unsigned Slot, const MDLocation *Loc)
+    VariableDbgInfo(const DILocalVariable *Var, const DIExpression *Expr,
+                    unsigned Slot, const DILocation *Loc)
         : Var(Var), Expr(Expr), Slot(Slot), Loc(Loc) {}
   };
   typedef SmallVector<VariableDbgInfo, 4> VariableDbgInfoMapTy;
@@ -448,8 +448,8 @@
 
   /// setVariableDbgInfo - Collect information used to emit debugging
   /// information of a variable.
-  void setVariableDbgInfo(const MDLocalVariable *Var, const MDExpression *Expr,
-                          unsigned Slot, const MDLocation *Loc) {
+  void setVariableDbgInfo(const DILocalVariable *Var, const DIExpression *Expr,
+                          unsigned Slot, const DILocation *Loc) {
     VariableDbgInfos.emplace_back(Var, Expr, Slot, Loc);
   }
 
diff --git a/llvm/include/llvm/IR/DIBuilder.h b/llvm/include/llvm/IR/DIBuilder.h
index 0ed97b6..68fb59b 100644
--- a/llvm/include/llvm/IR/DIBuilder.h
+++ b/llvm/include/llvm/IR/DIBuilder.h
@@ -104,7 +104,7 @@
     ///                        source location information in the back end
     ///                        without actually changing the output (e.g.,
     ///                        when using optimization remarks).
-    MDCompileUnit *createCompileUnit(unsigned Lang, StringRef File,
+    DICompileUnit *createCompileUnit(unsigned Lang, StringRef File,
                                      StringRef Dir, StringRef Producer,
                                      bool isOptimized, StringRef Flags,
                                      unsigned RV, StringRef SplitName = "",
@@ -113,16 +113,16 @@
 
     /// createFile - Create a file descriptor to hold debugging information
     /// for a file.
-    MDFile *createFile(StringRef Filename, StringRef Directory);
+    DIFile *createFile(StringRef Filename, StringRef Directory);
 
     /// createEnumerator - Create a single enumerator value.
-    MDEnumerator *createEnumerator(StringRef Name, int64_t Val);
+    DIEnumerator *createEnumerator(StringRef Name, int64_t Val);
 
     /// \brief Create a DWARF unspecified type.
-    MDBasicType *createUnspecifiedType(StringRef Name);
+    DIBasicType *createUnspecifiedType(StringRef Name);
 
     /// \brief Create C++11 nullptr type.
-    MDBasicType *createNullPtrType();
+    DIBasicType *createNullPtrType();
 
     /// createBasicType - Create debugging information entry for a basic
     /// type.
@@ -130,21 +130,21 @@
     /// @param SizeInBits  Size of the type.
     /// @param AlignInBits Type alignment.
     /// @param Encoding    DWARF encoding code, e.g. dwarf::DW_ATE_float.
-    MDBasicType *createBasicType(StringRef Name, uint64_t SizeInBits,
+    DIBasicType *createBasicType(StringRef Name, uint64_t SizeInBits,
                                  uint64_t AlignInBits, unsigned Encoding);
 
     /// createQualifiedType - Create debugging information entry for a qualified
     /// type, e.g. 'const int'.
     /// @param Tag         Tag identifing type, e.g. dwarf::TAG_volatile_type
     /// @param FromTy      Base Type.
-    MDDerivedType *createQualifiedType(unsigned Tag, MDType *FromTy);
+    DIDerivedType *createQualifiedType(unsigned Tag, DIType *FromTy);
 
     /// createPointerType - Create debugging information entry for a pointer.
     /// @param PointeeTy   Type pointed by this pointer.
     /// @param SizeInBits  Size.
     /// @param AlignInBits Alignment. (optional)
     /// @param Name        Pointer type name. (optional)
-    MDDerivedType *createPointerType(MDType *PointeeTy, uint64_t SizeInBits,
+    DIDerivedType *createPointerType(DIType *PointeeTy, uint64_t SizeInBits,
                                      uint64_t AlignInBits = 0,
                                      StringRef Name = "");
 
@@ -153,13 +153,13 @@
     /// @param SizeInBits  Size.
     /// @param AlignInBits Alignment. (optional)
     /// @param Class Type for which this pointer points to members of.
-    MDDerivedType *createMemberPointerType(MDType *PointeeTy, MDType *Class,
+    DIDerivedType *createMemberPointerType(DIType *PointeeTy, DIType *Class,
                                            uint64_t SizeInBits,
                                            uint64_t AlignInBits = 0);
 
     /// createReferenceType - Create debugging information entry for a c++
     /// style reference or rvalue reference type.
-    MDDerivedType *createReferenceType(unsigned Tag, MDType *RTy);
+    DIDerivedType *createReferenceType(unsigned Tag, DIType *RTy);
 
     /// createTypedef - Create debugging information entry for a typedef.
     /// @param Ty          Original type.
@@ -167,11 +167,11 @@
     /// @param File        File where this type is defined.
     /// @param LineNo      Line number.
     /// @param Context     The surrounding context for the typedef.
-    MDDerivedType *createTypedef(MDType *Ty, StringRef Name, MDFile *File,
-                                 unsigned LineNo, MDScope *Context);
+    DIDerivedType *createTypedef(DIType *Ty, StringRef Name, DIFile *File,
+                                 unsigned LineNo, DIScope *Context);
 
     /// createFriend - Create debugging information entry for a 'friend'.
-    MDDerivedType *createFriend(MDType *Ty, MDType *FriendTy);
+    DIDerivedType *createFriend(DIType *Ty, DIType *FriendTy);
 
     /// createInheritance - Create debugging information entry to establish
     /// inheritance relationship between two types.
@@ -180,7 +180,7 @@
     /// @param BaseOffset   Base offset.
     /// @param Flags        Flags to describe inheritance attribute,
     ///                     e.g. private
-    MDDerivedType *createInheritance(MDType *Ty, MDType *BaseTy,
+    DIDerivedType *createInheritance(DIType *Ty, DIType *BaseTy,
                                      uint64_t BaseOffset, unsigned Flags);
 
     /// createMemberType - Create debugging information entry for a member.
@@ -193,11 +193,11 @@
     /// @param OffsetInBits Member offset.
     /// @param Flags        Flags to encode member attribute, e.g. private
     /// @param Ty           Parent type.
-    MDDerivedType *createMemberType(MDScope *Scope, StringRef Name,
-                                    MDFile *File, unsigned LineNo,
+    DIDerivedType *createMemberType(DIScope *Scope, StringRef Name,
+                                    DIFile *File, unsigned LineNo,
                                     uint64_t SizeInBits, uint64_t AlignInBits,
                                     uint64_t OffsetInBits, unsigned Flags,
-                                    MDType *Ty);
+                                    DIType *Ty);
 
     /// createStaticMemberType - Create debugging information entry for a
     /// C++ static data member.
@@ -208,9 +208,9 @@
     /// @param Ty         Type of the static member.
     /// @param Flags      Flags to encode member attribute, e.g. private.
     /// @param Val        Const initializer of the member.
-    MDDerivedType *createStaticMemberType(MDScope *Scope, StringRef Name,
-                                          MDFile *File, unsigned LineNo,
-                                          MDType *Ty, unsigned Flags,
+    DIDerivedType *createStaticMemberType(DIScope *Scope, StringRef Name,
+                                          DIFile *File, unsigned LineNo,
+                                          DIType *Ty, unsigned Flags,
                                           llvm::Constant *Val);
 
     /// createObjCIVar - Create debugging information entry for Objective-C
@@ -224,10 +224,10 @@
     /// @param Flags        Flags to encode member attribute, e.g. private
     /// @param Ty           Parent type.
     /// @param PropertyNode Property associated with this ivar.
-    MDDerivedType *createObjCIVar(StringRef Name, MDFile *File, unsigned LineNo,
+    DIDerivedType *createObjCIVar(StringRef Name, DIFile *File, unsigned LineNo,
                                   uint64_t SizeInBits, uint64_t AlignInBits,
                                   uint64_t OffsetInBits, unsigned Flags,
-                                  MDType *Ty, MDNode *PropertyNode);
+                                  DIType *Ty, MDNode *PropertyNode);
 
     /// createObjCProperty - Create debugging information entry for Objective-C
     /// property.
@@ -238,11 +238,11 @@
     /// @param SetterName   Name of the Objective C property setter selector.
     /// @param PropertyAttributes Objective C property attributes.
     /// @param Ty           Type.
-    MDObjCProperty *createObjCProperty(StringRef Name, MDFile *File,
+    DIObjCProperty *createObjCProperty(StringRef Name, DIFile *File,
                                        unsigned LineNumber,
                                        StringRef GetterName,
                                        StringRef SetterName,
-                                       unsigned PropertyAttributes, MDType *Ty);
+                                       unsigned PropertyAttributes, DIType *Ty);
 
     /// createClassType - Create debugging information entry for a class.
     /// @param Scope        Scope in which this class is defined.
@@ -260,12 +260,14 @@
     ///                     for more info.
     /// @param TemplateParms Template type parameters.
     /// @param UniqueIdentifier A unique identifier for the class.
-    MDCompositeType *createClassType(
-        MDScope *Scope, StringRef Name, MDFile *File, unsigned LineNumber,
-        uint64_t SizeInBits, uint64_t AlignInBits, uint64_t OffsetInBits,
-        unsigned Flags, MDType *DerivedFrom, DebugNodeArray Elements,
-        MDType *VTableHolder = nullptr, MDNode *TemplateParms = nullptr,
-        StringRef UniqueIdentifier = "");
+    DICompositeType *createClassType(DIScope *Scope, StringRef Name,
+                                     DIFile *File, unsigned LineNumber,
+                                     uint64_t SizeInBits, uint64_t AlignInBits,
+                                     uint64_t OffsetInBits, unsigned Flags,
+                                     DIType *DerivedFrom, DINodeArray Elements,
+                                     DIType *VTableHolder = nullptr,
+                                     MDNode *TemplateParms = nullptr,
+                                     StringRef UniqueIdentifier = "");
 
     /// createStructType - Create debugging information entry for a struct.
     /// @param Scope        Scope in which this struct is defined.
@@ -278,11 +280,11 @@
     /// @param Elements     Struct elements.
     /// @param RunTimeLang  Optional parameter, Objective-C runtime version.
     /// @param UniqueIdentifier A unique identifier for the struct.
-    MDCompositeType *createStructType(
-        MDScope *Scope, StringRef Name, MDFile *File, unsigned LineNumber,
+    DICompositeType *createStructType(
+        DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber,
         uint64_t SizeInBits, uint64_t AlignInBits, unsigned Flags,
-        MDType *DerivedFrom, DebugNodeArray Elements, unsigned RunTimeLang = 0,
-        MDType *VTableHolder = nullptr, StringRef UniqueIdentifier = "");
+        DIType *DerivedFrom, DINodeArray Elements, unsigned RunTimeLang = 0,
+        DIType *VTableHolder = nullptr, StringRef UniqueIdentifier = "");
 
     /// createUnionType - Create debugging information entry for an union.
     /// @param Scope        Scope in which this union is defined.
@@ -295,10 +297,10 @@
     /// @param Elements     Union elements.
     /// @param RunTimeLang  Optional parameter, Objective-C runtime version.
     /// @param UniqueIdentifier A unique identifier for the union.
-    MDCompositeType *createUnionType(MDScope *Scope, StringRef Name,
-                                     MDFile *File, unsigned LineNumber,
+    DICompositeType *createUnionType(DIScope *Scope, StringRef Name,
+                                     DIFile *File, unsigned LineNumber,
                                      uint64_t SizeInBits, uint64_t AlignInBits,
-                                     unsigned Flags, DebugNodeArray Elements,
+                                     unsigned Flags, DINodeArray Elements,
                                      unsigned RunTimeLang = 0,
                                      StringRef UniqueIdentifier = "");
 
@@ -307,8 +309,8 @@
     /// @param Scope        Scope in which this type is defined.
     /// @param Name         Type parameter name.
     /// @param Ty           Parameter type.
-    MDTemplateTypeParameter *
-    createTemplateTypeParameter(MDScope *Scope, StringRef Name, MDType *Ty);
+    DITemplateTypeParameter *
+    createTemplateTypeParameter(DIScope *Scope, StringRef Name, DIType *Ty);
 
     /// createTemplateValueParameter - Create debugging information for template
     /// value parameter.
@@ -316,9 +318,9 @@
     /// @param Name         Value parameter name.
     /// @param Ty           Parameter type.
     /// @param Val          Constant parameter value.
-    MDTemplateValueParameter *createTemplateValueParameter(MDScope *Scope,
+    DITemplateValueParameter *createTemplateValueParameter(DIScope *Scope,
                                                            StringRef Name,
-                                                           MDType *Ty,
+                                                           DIType *Ty,
                                                            Constant *Val);
 
     /// \brief Create debugging information for a template template parameter.
@@ -326,9 +328,9 @@
     /// @param Name         Value parameter name.
     /// @param Ty           Parameter type.
     /// @param Val          The fully qualified name of the template.
-    MDTemplateValueParameter *createTemplateTemplateParameter(MDScope *Scope,
+    DITemplateValueParameter *createTemplateTemplateParameter(DIScope *Scope,
                                                               StringRef Name,
-                                                              MDType *Ty,
+                                                              DIType *Ty,
                                                               StringRef Val);
 
     /// \brief Create debugging information for a template parameter pack.
@@ -336,26 +338,26 @@
     /// @param Name         Value parameter name.
     /// @param Ty           Parameter type.
     /// @param Val          An array of types in the pack.
-    MDTemplateValueParameter *createTemplateParameterPack(MDScope *Scope,
+    DITemplateValueParameter *createTemplateParameterPack(DIScope *Scope,
                                                           StringRef Name,
-                                                          MDType *Ty,
-                                                          DebugNodeArray Val);
+                                                          DIType *Ty,
+                                                          DINodeArray Val);
 
     /// createArrayType - Create debugging information entry for an array.
     /// @param Size         Array size.
     /// @param AlignInBits  Alignment.
     /// @param Ty           Element type.
     /// @param Subscripts   Subscripts.
-    MDCompositeType *createArrayType(uint64_t Size, uint64_t AlignInBits,
-                                     MDType *Ty, DebugNodeArray Subscripts);
+    DICompositeType *createArrayType(uint64_t Size, uint64_t AlignInBits,
+                                     DIType *Ty, DINodeArray Subscripts);
 
     /// createVectorType - Create debugging information entry for a vector type.
     /// @param Size         Array size.
     /// @param AlignInBits  Alignment.
     /// @param Ty           Element type.
     /// @param Subscripts   Subscripts.
-    MDCompositeType *createVectorType(uint64_t Size, uint64_t AlignInBits,
-                                      MDType *Ty, DebugNodeArray Subscripts);
+    DICompositeType *createVectorType(uint64_t Size, uint64_t AlignInBits,
+                                      DIType *Ty, DINodeArray Subscripts);
 
     /// createEnumerationType - Create debugging information entry for an
     /// enumeration.
@@ -368,10 +370,10 @@
     /// @param Elements       Enumeration elements.
     /// @param UnderlyingType Underlying type of a C++11/ObjC fixed enum.
     /// @param UniqueIdentifier A unique identifier for the enum.
-    MDCompositeType *createEnumerationType(
-        MDScope *Scope, StringRef Name, MDFile *File, unsigned LineNumber,
-        uint64_t SizeInBits, uint64_t AlignInBits, DebugNodeArray Elements,
-        MDType *UnderlyingType, StringRef UniqueIdentifier = "");
+    DICompositeType *createEnumerationType(
+        DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber,
+        uint64_t SizeInBits, uint64_t AlignInBits, DINodeArray Elements,
+        DIType *UnderlyingType, StringRef UniqueIdentifier = "");
 
     /// createSubroutineType - Create subroutine type.
     /// @param File            File in which this subroutine is defined.
@@ -379,49 +381,49 @@
     ///                        includes return type at 0th index.
     /// @param Flags           E.g.: LValueReference.
     ///                        These flags are used to emit dwarf attributes.
-    MDSubroutineType *createSubroutineType(MDFile *File,
-                                           MDTypeRefArray ParameterTypes,
+    DISubroutineType *createSubroutineType(DIFile *File,
+                                           DITypeRefArray ParameterTypes,
                                            unsigned Flags = 0);
 
-    /// createArtificialType - Create a new MDType* with "artificial" flag set.
-    MDType *createArtificialType(MDType *Ty);
+    /// createArtificialType - Create a new DIType* with "artificial" flag set.
+    DIType *createArtificialType(DIType *Ty);
 
-    /// createObjectPointerType - Create a new MDType* with the "object pointer"
+    /// createObjectPointerType - Create a new DIType* with the "object pointer"
     /// flag set.
-    MDType *createObjectPointerType(MDType *Ty);
+    DIType *createObjectPointerType(DIType *Ty);
 
     /// \brief Create a permanent forward-declared type.
-    MDCompositeType *createForwardDecl(unsigned Tag, StringRef Name,
-                                       MDScope *Scope, MDFile *F, unsigned Line,
+    DICompositeType *createForwardDecl(unsigned Tag, StringRef Name,
+                                       DIScope *Scope, DIFile *F, unsigned Line,
                                        unsigned RuntimeLang = 0,
                                        uint64_t SizeInBits = 0,
                                        uint64_t AlignInBits = 0,
                                        StringRef UniqueIdentifier = "");
 
     /// \brief Create a temporary forward-declared type.
-    MDCompositeType *createReplaceableCompositeType(
-        unsigned Tag, StringRef Name, MDScope *Scope, MDFile *F, unsigned Line,
+    DICompositeType *createReplaceableCompositeType(
+        unsigned Tag, StringRef Name, DIScope *Scope, DIFile *F, unsigned Line,
         unsigned RuntimeLang = 0, uint64_t SizeInBits = 0,
-        uint64_t AlignInBits = 0, unsigned Flags = DebugNode::FlagFwdDecl,
+        uint64_t AlignInBits = 0, unsigned Flags = DINode::FlagFwdDecl,
         StringRef UniqueIdentifier = "");
 
-    /// retainType - Retain MDType* in a module even if it is not referenced
+    /// retainType - Retain DIType* in a module even if it is not referenced
     /// through debug info anchors.
-    void retainType(MDType *T);
+    void retainType(DIType *T);
 
     /// createUnspecifiedParameter - Create unspecified parameter type
     /// for a subroutine type.
-    MDBasicType *createUnspecifiedParameter();
+    DIBasicType *createUnspecifiedParameter();
 
-    /// getOrCreateArray - Get a DebugNodeArray, create one if required.
-    DebugNodeArray getOrCreateArray(ArrayRef<Metadata *> Elements);
+    /// getOrCreateArray - Get a DINodeArray, create one if required.
+    DINodeArray getOrCreateArray(ArrayRef<Metadata *> Elements);
 
-    /// getOrCreateTypeArray - Get a MDTypeRefArray, create one if required.
-    MDTypeRefArray getOrCreateTypeArray(ArrayRef<Metadata *> Elements);
+    /// getOrCreateTypeArray - Get a DITypeRefArray, create one if required.
+    DITypeRefArray getOrCreateTypeArray(ArrayRef<Metadata *> Elements);
 
     /// getOrCreateSubrange - Create a descriptor for a value range.  This
     /// implicitly uniques the values returned.
-    MDSubrange *getOrCreateSubrange(int64_t Lo, int64_t Count);
+    DISubrange *getOrCreateSubrange(int64_t Lo, int64_t Count);
 
     /// createGlobalVariable - Create a new descriptor for the specified
     /// variable.
@@ -435,18 +437,18 @@
     ///                      externally visible or not.
     /// @param Val         llvm::Value of the variable.
     /// @param Decl        Reference to the corresponding declaration.
-    MDGlobalVariable *createGlobalVariable(MDScope *Context, StringRef Name,
-                                           StringRef LinkageName, MDFile *File,
-                                           unsigned LineNo, MDType *Ty,
+    DIGlobalVariable *createGlobalVariable(DIScope *Context, StringRef Name,
+                                           StringRef LinkageName, DIFile *File,
+                                           unsigned LineNo, DIType *Ty,
                                            bool isLocalToUnit,
                                            llvm::Constant *Val,
                                            MDNode *Decl = nullptr);
 
     /// createTempGlobalVariableFwdDecl - Identical to createGlobalVariable
     /// except that the resulting DbgNode is temporary and meant to be RAUWed.
-    MDGlobalVariable *createTempGlobalVariableFwdDecl(
-        MDScope *Context, StringRef Name, StringRef LinkageName, MDFile *File,
-        unsigned LineNo, MDType *Ty, bool isLocalToUnit, llvm::Constant *Val,
+    DIGlobalVariable *createTempGlobalVariableFwdDecl(
+        DIScope *Context, StringRef Name, StringRef LinkageName, DIFile *File,
+        unsigned LineNo, DIType *Ty, bool isLocalToUnit, llvm::Constant *Val,
         MDNode *Decl = nullptr);
 
     /// createLocalVariable - Create a new descriptor for the specified
@@ -463,9 +465,9 @@
     /// @param Flags       Flags, e.g. artificial variable.
     /// @param ArgNo       If this variable is an argument then this argument's
     ///                    number. 1 indicates 1st argument.
-    MDLocalVariable *createLocalVariable(unsigned Tag, MDScope *Scope,
-                                         StringRef Name, MDFile *File,
-                                         unsigned LineNo, MDType *Ty,
+    DILocalVariable *createLocalVariable(unsigned Tag, DIScope *Scope,
+                                         StringRef Name, DIFile *File,
+                                         unsigned LineNo, DIType *Ty,
                                          bool AlwaysPreserve = false,
                                          unsigned Flags = 0,
                                          unsigned ArgNo = 0);
@@ -473,19 +475,19 @@
     /// createExpression - Create a new descriptor for the specified
     /// variable which has a complex address expression for its address.
     /// @param Addr        An array of complex address operations.
-    MDExpression *createExpression(ArrayRef<uint64_t> Addr = None);
-    MDExpression *createExpression(ArrayRef<int64_t> Addr);
+    DIExpression *createExpression(ArrayRef<uint64_t> Addr = None);
+    DIExpression *createExpression(ArrayRef<int64_t> Addr);
 
     /// createBitPieceExpression - Create a descriptor to describe one part
     /// of aggregate variable that is fragmented across multiple Values.
     ///
     /// @param OffsetInBits Offset of the piece in bits.
     /// @param SizeInBits   Size of the piece in bits.
-    MDExpression *createBitPieceExpression(unsigned OffsetInBits,
+    DIExpression *createBitPieceExpression(unsigned OffsetInBits,
                                            unsigned SizeInBits);
 
     /// createFunction - Create a new descriptor for the specified subprogram.
-    /// See comments in MDSubprogram* for descriptions of these fields.
+    /// See comments in DISubprogram* for descriptions of these fields.
     /// @param Scope         Function scope.
     /// @param Name          Function name.
     /// @param LinkageName   Mangled function name.
@@ -500,9 +502,9 @@
     /// @param isOptimized   True if optimization is ON.
     /// @param Fn            llvm::Function pointer.
     /// @param TParam        Function template parameters.
-    MDSubprogram *
-    createFunction(MDScope *Scope, StringRef Name, StringRef LinkageName,
-                   MDFile *File, unsigned LineNo, MDSubroutineType *Ty,
+    DISubprogram *
+    createFunction(DIScope *Scope, StringRef Name, StringRef LinkageName,
+                   DIFile *File, unsigned LineNo, DISubroutineType *Ty,
                    bool isLocalToUnit, bool isDefinition, unsigned ScopeLine,
                    unsigned Flags = 0, bool isOptimized = false,
                    Function *Fn = nullptr, MDNode *TParam = nullptr,
@@ -510,25 +512,25 @@
 
     /// createTempFunctionFwdDecl - Identical to createFunction,
     /// except that the resulting DbgNode is meant to be RAUWed.
-    MDSubprogram *createTempFunctionFwdDecl(
-        MDScope *Scope, StringRef Name, StringRef LinkageName, MDFile *File,
-        unsigned LineNo, MDSubroutineType *Ty, bool isLocalToUnit,
+    DISubprogram *createTempFunctionFwdDecl(
+        DIScope *Scope, StringRef Name, StringRef LinkageName, DIFile *File,
+        unsigned LineNo, DISubroutineType *Ty, bool isLocalToUnit,
         bool isDefinition, unsigned ScopeLine, unsigned Flags = 0,
         bool isOptimized = false, Function *Fn = nullptr,
         MDNode *TParam = nullptr, MDNode *Decl = nullptr);
 
     /// FIXME: this is added for dragonegg. Once we update dragonegg
     /// to call resolve function, this will be removed.
-    MDSubprogram *
-    createFunction(MDScopeRef Scope, StringRef Name, StringRef LinkageName,
-                   MDFile *File, unsigned LineNo, MDSubroutineType *Ty,
+    DISubprogram *
+    createFunction(DIScopeRef Scope, StringRef Name, StringRef LinkageName,
+                   DIFile *File, unsigned LineNo, DISubroutineType *Ty,
                    bool isLocalToUnit, bool isDefinition, unsigned ScopeLine,
                    unsigned Flags = 0, bool isOptimized = false,
                    Function *Fn = nullptr, MDNode *TParam = nullptr,
                    MDNode *Decl = nullptr);
 
     /// createMethod - Create a new descriptor for the specified C++ method.
-    /// See comments in MDSubprogram* for descriptions of these fields.
+    /// See comments in DISubprogram* for descriptions of these fields.
     /// @param Scope         Function scope.
     /// @param Name          Function name.
     /// @param LinkageName   Mangled function name.
@@ -546,11 +548,11 @@
     /// @param isOptimized   True if optimization is ON.
     /// @param Fn            llvm::Function pointer.
     /// @param TParam        Function template parameters.
-    MDSubprogram *
-    createMethod(MDScope *Scope, StringRef Name, StringRef LinkageName,
-                 MDFile *File, unsigned LineNo, MDSubroutineType *Ty,
+    DISubprogram *
+    createMethod(DIScope *Scope, StringRef Name, StringRef LinkageName,
+                 DIFile *File, unsigned LineNo, DISubroutineType *Ty,
                  bool isLocalToUnit, bool isDefinition, unsigned Virtuality = 0,
-                 unsigned VTableIndex = 0, MDType *VTableHolder = nullptr,
+                 unsigned VTableIndex = 0, DIType *VTableHolder = nullptr,
                  unsigned Flags = 0, bool isOptimized = false,
                  Function *Fn = nullptr, MDNode *TParam = nullptr);
 
@@ -560,7 +562,7 @@
     /// @param Name        Name of this namespace
     /// @param File        Source file
     /// @param LineNo      Line number
-    MDNamespace *createNameSpace(MDScope *Scope, StringRef Name, MDFile *File,
+    DINamespace *createNameSpace(DIScope *Scope, StringRef Name, DIFile *File,
                                  unsigned LineNo);
 
     /// createLexicalBlockFile - This creates a descriptor for a lexical
@@ -569,7 +571,7 @@
     /// @param Scope       Lexical block.
     /// @param File        Source file.
     /// @param Discriminator DWARF path discriminator value.
-    MDLexicalBlockFile *createLexicalBlockFile(MDScope *Scope, MDFile *File,
+    DILexicalBlockFile *createLexicalBlockFile(DIScope *Scope, DIFile *File,
                                                unsigned Discriminator = 0);
 
     /// createLexicalBlock - This creates a descriptor for a lexical block
@@ -578,30 +580,30 @@
     /// @param File          Source file.
     /// @param Line          Line number.
     /// @param Col           Column number.
-    MDLexicalBlock *createLexicalBlock(MDScope *Scope, MDFile *File,
+    DILexicalBlock *createLexicalBlock(DIScope *Scope, DIFile *File,
                                        unsigned Line, unsigned Col);
 
     /// \brief Create a descriptor for an imported module.
     /// @param Context The scope this module is imported into
     /// @param NS The namespace being imported here
     /// @param Line Line number
-    MDImportedEntity *createImportedModule(MDScope *Context, MDNamespace *NS,
+    DIImportedEntity *createImportedModule(DIScope *Context, DINamespace *NS,
                                            unsigned Line);
 
     /// \brief Create a descriptor for an imported module.
     /// @param Context The scope this module is imported into
     /// @param NS An aliased namespace
     /// @param Line Line number
-    MDImportedEntity *createImportedModule(MDScope *Context,
-                                           MDImportedEntity *NS, unsigned Line);
+    DIImportedEntity *createImportedModule(DIScope *Context,
+                                           DIImportedEntity *NS, unsigned Line);
 
     /// \brief Create a descriptor for an imported function.
     /// @param Context The scope this module is imported into
     /// @param Decl The declaration (or definition) of a function, type, or
     ///             variable
     /// @param Line Line number
-    MDImportedEntity *createImportedDeclaration(MDScope *Context,
-                                                DebugNode *Decl, unsigned Line,
+    DIImportedEntity *createImportedDeclaration(DIScope *Context, DINode *Decl,
+                                                unsigned Line,
                                                 StringRef Name = "");
 
     /// insertDeclare - Insert a new llvm.dbg.declare intrinsic call.
@@ -610,8 +612,8 @@
     /// @param Expr         A complex location expression.
     /// @param DL           Debug info location.
     /// @param InsertAtEnd Location for the new intrinsic.
-    Instruction *insertDeclare(llvm::Value *Storage, MDLocalVariable *VarInfo,
-                               MDExpression *Expr, const MDLocation *DL,
+    Instruction *insertDeclare(llvm::Value *Storage, DILocalVariable *VarInfo,
+                               DIExpression *Expr, const DILocation *DL,
                                BasicBlock *InsertAtEnd);
 
     /// insertDeclare - Insert a new llvm.dbg.declare intrinsic call.
@@ -620,8 +622,8 @@
     /// @param Expr         A complex location expression.
     /// @param DL           Debug info location.
     /// @param InsertBefore Location for the new intrinsic.
-    Instruction *insertDeclare(llvm::Value *Storage, MDLocalVariable *VarInfo,
-                               MDExpression *Expr, const MDLocation *DL,
+    Instruction *insertDeclare(llvm::Value *Storage, DILocalVariable *VarInfo,
+                               DIExpression *Expr, const DILocation *DL,
                                Instruction *InsertBefore);
 
     /// insertDbgValueIntrinsic - Insert a new llvm.dbg.value intrinsic call.
@@ -632,9 +634,9 @@
     /// @param DL           Debug info location.
     /// @param InsertAtEnd Location for the new intrinsic.
     Instruction *insertDbgValueIntrinsic(llvm::Value *Val, uint64_t Offset,
-                                         MDLocalVariable *VarInfo,
-                                         MDExpression *Expr,
-                                         const MDLocation *DL,
+                                         DILocalVariable *VarInfo,
+                                         DIExpression *Expr,
+                                         const DILocation *DL,
                                          BasicBlock *InsertAtEnd);
 
     /// insertDbgValueIntrinsic - Insert a new llvm.dbg.value intrinsic call.
@@ -645,25 +647,25 @@
     /// @param DL           Debug info location.
     /// @param InsertBefore Location for the new intrinsic.
     Instruction *insertDbgValueIntrinsic(llvm::Value *Val, uint64_t Offset,
-                                         MDLocalVariable *VarInfo,
-                                         MDExpression *Expr,
-                                         const MDLocation *DL,
+                                         DILocalVariable *VarInfo,
+                                         DIExpression *Expr,
+                                         const DILocation *DL,
                                          Instruction *InsertBefore);
 
     /// \brief Replace the vtable holder in the given composite type.
     ///
     /// If this creates a self reference, it may orphan some unresolved cycles
     /// in the operands of \c T, so \a DIBuilder needs to track that.
-    void replaceVTableHolder(MDCompositeType *&T,
-                             MDCompositeType *VTableHolder);
+    void replaceVTableHolder(DICompositeType *&T,
+                             DICompositeType *VTableHolder);
 
     /// \brief Replace arrays on a composite type.
     ///
     /// If \c T is resolved, but the arrays aren't -- which can happen if \c T
     /// has a self-reference -- \a DIBuilder needs to track the array to
     /// resolve cycles.
-    void replaceArrays(MDCompositeType *&T, DebugNodeArray Elements,
-                       DebugNodeArray TParems = DebugNodeArray());
+    void replaceArrays(DICompositeType *&T, DINodeArray Elements,
+                       DINodeArray TParems = DINodeArray());
 
     /// \brief Replace a temporary node.
     ///
diff --git a/llvm/include/llvm/IR/DebugInfo.h b/llvm/include/llvm/IR/DebugInfo.h
index b32bdb6..5429648 100644
--- a/llvm/include/llvm/IR/DebugInfo.h
+++ b/llvm/include/llvm/IR/DebugInfo.h
@@ -34,18 +34,18 @@
 class DbgValueInst;
 
 /// \brief Maps from type identifier to the actual MDNode.
-typedef DenseMap<const MDString *, MDType *> DITypeIdentifierMap;
+typedef DenseMap<const MDString *, DIType *> DITypeIdentifierMap;
 
 /// \brief Find subprogram that is enclosing this scope.
-MDSubprogram *getDISubprogram(const MDNode *Scope);
+DISubprogram *getDISubprogram(const MDNode *Scope);
 
 /// \brief Find debug info for a given function.
 ///
 /// \returns a valid subprogram, if found. Otherwise, return \c nullptr.
-MDSubprogram *getDISubprogram(const Function *F);
+DISubprogram *getDISubprogram(const Function *F);
 
 /// \brief Find underlying composite type.
-MDCompositeTypeBase *getDICompositeType(MDType *T);
+DICompositeTypeBase *getDICompositeType(DIType *T);
 
 /// \brief Generate map by visiting all retained types.
 DITypeIdentifierMap generateDITypeIdentifierMap(const NamedMDNode *CU_Nodes);
@@ -81,7 +81,7 @@
   /// \brief Process DbgValueInst.
   void processValue(const Module &M, const DbgValueInst *DVI);
   /// \brief Process debug info location.
-  void processLocation(const Module &M, const MDLocation *Loc);
+  void processLocation(const Module &M, const DILocation *Loc);
 
   /// \brief Clear all lists.
   void reset();
@@ -89,23 +89,23 @@
 private:
   void InitializeTypeMap(const Module &M);
 
-  void processType(MDType *DT);
-  void processSubprogram(MDSubprogram *SP);
-  void processScope(MDScope *Scope);
-  bool addCompileUnit(MDCompileUnit *CU);
-  bool addGlobalVariable(MDGlobalVariable *DIG);
-  bool addSubprogram(MDSubprogram *SP);
-  bool addType(MDType *DT);
-  bool addScope(MDScope *Scope);
+  void processType(DIType *DT);
+  void processSubprogram(DISubprogram *SP);
+  void processScope(DIScope *Scope);
+  bool addCompileUnit(DICompileUnit *CU);
+  bool addGlobalVariable(DIGlobalVariable *DIG);
+  bool addSubprogram(DISubprogram *SP);
+  bool addType(DIType *DT);
+  bool addScope(DIScope *Scope);
 
 public:
-  typedef SmallVectorImpl<MDCompileUnit *>::const_iterator
+  typedef SmallVectorImpl<DICompileUnit *>::const_iterator
       compile_unit_iterator;
-  typedef SmallVectorImpl<MDSubprogram *>::const_iterator subprogram_iterator;
-  typedef SmallVectorImpl<MDGlobalVariable *>::const_iterator
+  typedef SmallVectorImpl<DISubprogram *>::const_iterator subprogram_iterator;
+  typedef SmallVectorImpl<DIGlobalVariable *>::const_iterator
       global_variable_iterator;
-  typedef SmallVectorImpl<MDType *>::const_iterator type_iterator;
-  typedef SmallVectorImpl<MDScope *>::const_iterator scope_iterator;
+  typedef SmallVectorImpl<DIType *>::const_iterator type_iterator;
+  typedef SmallVectorImpl<DIScope *>::const_iterator scope_iterator;
 
   iterator_range<compile_unit_iterator> compile_units() const {
     return iterator_range<compile_unit_iterator>(CUs.begin(), CUs.end());
@@ -134,11 +134,11 @@
   unsigned scope_count() const { return Scopes.size(); }
 
 private:
-  SmallVector<MDCompileUnit *, 8> CUs;
-  SmallVector<MDSubprogram *, 8> SPs;
-  SmallVector<MDGlobalVariable *, 8> GVs;
-  SmallVector<MDType *, 8> TYs;
-  SmallVector<MDScope *, 8> Scopes;
+  SmallVector<DICompileUnit *, 8> CUs;
+  SmallVector<DISubprogram *, 8> SPs;
+  SmallVector<DIGlobalVariable *, 8> GVs;
+  SmallVector<DIType *, 8> TYs;
+  SmallVector<DIScope *, 8> Scopes;
   SmallPtrSet<const MDNode *, 64> NodesSeen;
   DITypeIdentifierMap TypeIdentifierMap;
 
@@ -146,7 +146,7 @@
   bool TypeMapInitialized;
 };
 
-DenseMap<const Function *, MDSubprogram *> makeSubprogramMap(const Module &M);
+DenseMap<const Function *, DISubprogram *> makeSubprogramMap(const Module &M);
 
 } // end namespace llvm
 
diff --git a/llvm/include/llvm/IR/DebugInfoMetadata.h b/llvm/include/llvm/IR/DebugInfoMetadata.h
index 6fef189..2be5e93 100644
--- a/llvm/include/llvm/IR/DebugInfoMetadata.h
+++ b/llvm/include/llvm/IR/DebugInfoMetadata.h
@@ -41,39 +41,39 @@
 
 namespace llvm {
 
-/// \brief Pointer union between a subclass of DebugNode and MDString.
+/// \brief Pointer union between a subclass of DINode and MDString.
 ///
-/// \a MDCompositeType can be referenced via an \a MDString unique identifier.
+/// \a DICompositeType can be referenced via an \a MDString unique identifier.
 /// This class allows some type safety in the face of that, requiring either a
 /// node of a particular type or an \a MDString.
-template <class T> class TypedDebugNodeRef {
+template <class T> class TypedDINodeRef {
   const Metadata *MD = nullptr;
 
 public:
-  TypedDebugNodeRef() = default;
-  TypedDebugNodeRef(std::nullptr_t) {}
+  TypedDINodeRef() = default;
+  TypedDINodeRef(std::nullptr_t) {}
 
   /// \brief Construct from a raw pointer.
-  explicit TypedDebugNodeRef(const Metadata *MD) : MD(MD) {
+  explicit TypedDINodeRef(const Metadata *MD) : MD(MD) {
     assert((!MD || isa<MDString>(MD) || isa<T>(MD)) && "Expected valid ref");
   }
 
   template <class U>
-  TypedDebugNodeRef(
-      const TypedDebugNodeRef<U> &X,
+  TypedDINodeRef(
+      const TypedDINodeRef<U> &X,
       typename std::enable_if<std::is_convertible<U *, T *>::value>::type * =
           nullptr)
       : MD(X) {}
 
   operator Metadata *() const { return const_cast<Metadata *>(MD); }
 
-  bool operator==(const TypedDebugNodeRef<T> &X) const { return MD == X.MD; };
-  bool operator!=(const TypedDebugNodeRef<T> &X) const { return MD != X.MD; };
+  bool operator==(const TypedDINodeRef<T> &X) const { return MD == X.MD; };
+  bool operator!=(const TypedDINodeRef<T> &X) const { return MD != X.MD; };
 
   /// \brief Create a reference.
   ///
   /// Get a reference to \c N, using an \a MDString reference if available.
-  static TypedDebugNodeRef get(const T *N);
+  static TypedDINodeRef get(const T *N);
 
   template <class MapTy> T *resolve(const MapTy &Map) const {
     if (!MD)
@@ -89,15 +89,15 @@
   }
 };
 
-typedef TypedDebugNodeRef<DebugNode> DebugNodeRef;
-typedef TypedDebugNodeRef<MDScope> MDScopeRef;
-typedef TypedDebugNodeRef<MDType> MDTypeRef;
+typedef TypedDINodeRef<DINode> DINodeRef;
+typedef TypedDINodeRef<DIScope> DIScopeRef;
+typedef TypedDINodeRef<DIType> DITypeRef;
 
-class MDTypeRefArray {
+class DITypeRefArray {
   const MDTuple *N = nullptr;
 
 public:
-  MDTypeRefArray(const MDTuple *N) : N(N) {}
+  DITypeRefArray(const MDTuple *N) : N(N) {}
 
   explicit operator bool() const { return get(); }
   explicit operator MDTuple *() const { return get(); }
@@ -108,16 +108,16 @@
 
   // FIXME: Fix callers and remove condition on N.
   unsigned size() const { return N ? N->getNumOperands() : 0u; }
-  MDTypeRef operator[](unsigned I) const { return MDTypeRef(N->getOperand(I)); }
+  DITypeRef operator[](unsigned I) const { return DITypeRef(N->getOperand(I)); }
 
-  class iterator : std::iterator<std::input_iterator_tag, MDTypeRef,
-                                 std::ptrdiff_t, void, MDTypeRef> {
+  class iterator : std::iterator<std::input_iterator_tag, DITypeRef,
+                                 std::ptrdiff_t, void, DITypeRef> {
     MDNode::op_iterator I = nullptr;
 
   public:
     iterator() = default;
     explicit iterator(MDNode::op_iterator I) : I(I) {}
-    MDTypeRef operator*() const { return MDTypeRef(*I); }
+    DITypeRef operator*() const { return DITypeRef(*I); }
     iterator &operator++() {
       ++I;
       return *this;
@@ -139,20 +139,20 @@
 /// \brief Tagged DWARF-like metadata node.
 ///
 /// A metadata node with a DWARF tag (i.e., a constant named \c DW_TAG_*,
-/// defined in llvm/Support/Dwarf.h).  Called \a DebugNode because it's
+/// defined in llvm/Support/Dwarf.h).  Called \a DINode because it's
 /// potentially used for non-DWARF output.
-class DebugNode : public MDNode {
+class DINode : public MDNode {
   friend class LLVMContextImpl;
   friend class MDNode;
 
 protected:
-  DebugNode(LLVMContext &C, unsigned ID, StorageType Storage, unsigned Tag,
-            ArrayRef<Metadata *> Ops1, ArrayRef<Metadata *> Ops2 = None)
+  DINode(LLVMContext &C, unsigned ID, StorageType Storage, unsigned Tag,
+         ArrayRef<Metadata *> Ops1, ArrayRef<Metadata *> Ops2 = None)
       : MDNode(C, ID, Storage, Ops1, Ops2) {
     assert(Tag < 1u << 16);
     SubclassData16 = Tag;
   }
-  ~DebugNode() = default;
+  ~DINode() = default;
 
   template <class Ty> Ty *getOperandAs(unsigned I) const {
     return cast_or_null<Ty>(getOperand(I));
@@ -193,47 +193,46 @@
   static unsigned splitFlags(unsigned Flags,
                              SmallVectorImpl<unsigned> &SplitFlags);
 
-  DebugNodeRef getRef() const { return DebugNodeRef::get(this); }
+  DINodeRef getRef() const { return DINodeRef::get(this); }
 
   static bool classof(const Metadata *MD) {
     switch (MD->getMetadataID()) {
     default:
       return false;
-    case GenericDebugNodeKind:
-    case MDSubrangeKind:
-    case MDEnumeratorKind:
-    case MDBasicTypeKind:
-    case MDDerivedTypeKind:
-    case MDCompositeTypeKind:
-    case MDSubroutineTypeKind:
-    case MDFileKind:
-    case MDCompileUnitKind:
-    case MDSubprogramKind:
-    case MDLexicalBlockKind:
-    case MDLexicalBlockFileKind:
-    case MDNamespaceKind:
-    case MDTemplateTypeParameterKind:
-    case MDTemplateValueParameterKind:
-    case MDGlobalVariableKind:
-    case MDLocalVariableKind:
-    case MDObjCPropertyKind:
-    case MDImportedEntityKind:
+    case GenericDINodeKind:
+    case DISubrangeKind:
+    case DIEnumeratorKind:
+    case DIBasicTypeKind:
+    case DIDerivedTypeKind:
+    case DICompositeTypeKind:
+    case DISubroutineTypeKind:
+    case DIFileKind:
+    case DICompileUnitKind:
+    case DISubprogramKind:
+    case DILexicalBlockKind:
+    case DILexicalBlockFileKind:
+    case DINamespaceKind:
+    case DITemplateTypeParameterKind:
+    case DITemplateValueParameterKind:
+    case DIGlobalVariableKind:
+    case DILocalVariableKind:
+    case DIObjCPropertyKind:
+    case DIImportedEntityKind:
       return true;
     }
   }
 };
 
-template <class T>
-struct simplify_type<const TypedDebugNodeRef<T>> {
+template <class T> struct simplify_type<const TypedDINodeRef<T>> {
   typedef Metadata *SimpleType;
-  static SimpleType getSimplifiedValue(const TypedDebugNodeRef<T> &MD) {
+  static SimpleType getSimplifiedValue(const TypedDINodeRef<T> &MD) {
     return MD;
   }
 };
 
 template <class T>
-struct simplify_type<TypedDebugNodeRef<T>>
-    : simplify_type<const TypedDebugNodeRef<T>> {};
+struct simplify_type<TypedDINodeRef<T>>
+    : simplify_type<const TypedDINodeRef<T>> {};
 
 /// \brief Generic tagged DWARF-like metadata node.
 ///
@@ -241,37 +240,33 @@
 /// (possibly empty) null-separated \a MDString header that contains arbitrary
 /// fields.  The remaining operands are \a dwarf_operands(), and are pointers
 /// to other metadata.
-class GenericDebugNode : public DebugNode {
+class GenericDINode : public DINode {
   friend class LLVMContextImpl;
   friend class MDNode;
 
-  GenericDebugNode(LLVMContext &C, StorageType Storage, unsigned Hash,
-                   unsigned Tag, ArrayRef<Metadata *> Ops1,
-                   ArrayRef<Metadata *> Ops2)
-      : DebugNode(C, GenericDebugNodeKind, Storage, Tag, Ops1, Ops2) {
+  GenericDINode(LLVMContext &C, StorageType Storage, unsigned Hash,
+                unsigned Tag, ArrayRef<Metadata *> Ops1,
+                ArrayRef<Metadata *> Ops2)
+      : DINode(C, GenericDINodeKind, Storage, Tag, Ops1, Ops2) {
     setHash(Hash);
   }
-  ~GenericDebugNode() { dropAllReferences(); }
+  ~GenericDINode() { dropAllReferences(); }
 
   void setHash(unsigned Hash) { SubclassData32 = Hash; }
   void recalculateHash();
 
-  static GenericDebugNode *getImpl(LLVMContext &Context, unsigned Tag,
-                                   StringRef Header,
-                                   ArrayRef<Metadata *> DwarfOps,
-                                   StorageType Storage,
-                                   bool ShouldCreate = true) {
+  static GenericDINode *getImpl(LLVMContext &Context, unsigned Tag,
+                                StringRef Header, ArrayRef<Metadata *> DwarfOps,
+                                StorageType Storage, bool ShouldCreate = true) {
     return getImpl(Context, Tag, getCanonicalMDString(Context, Header),
                    DwarfOps, Storage, ShouldCreate);
   }
 
-  static GenericDebugNode *getImpl(LLVMContext &Context, unsigned Tag,
-                                   MDString *Header,
-                                   ArrayRef<Metadata *> DwarfOps,
-                                   StorageType Storage,
-                                   bool ShouldCreate = true);
+  static GenericDINode *getImpl(LLVMContext &Context, unsigned Tag,
+                                MDString *Header, ArrayRef<Metadata *> DwarfOps,
+                                StorageType Storage, bool ShouldCreate = true);
 
-  TempGenericDebugNode cloneImpl() const {
+  TempGenericDINode cloneImpl() const {
     return getTemporary(
         getContext(), getTag(), getHeader(),
         SmallVector<Metadata *, 4>(dwarf_op_begin(), dwarf_op_end()));
@@ -280,15 +275,15 @@
 public:
   unsigned getHash() const { return SubclassData32; }
 
-  DEFINE_MDNODE_GET(GenericDebugNode, (unsigned Tag, StringRef Header,
-                                       ArrayRef<Metadata *> DwarfOps),
+  DEFINE_MDNODE_GET(GenericDINode, (unsigned Tag, StringRef Header,
+                                    ArrayRef<Metadata *> DwarfOps),
                     (Tag, Header, DwarfOps))
-  DEFINE_MDNODE_GET(GenericDebugNode, (unsigned Tag, MDString *Header,
-                                       ArrayRef<Metadata *> DwarfOps),
+  DEFINE_MDNODE_GET(GenericDINode, (unsigned Tag, MDString *Header,
+                                    ArrayRef<Metadata *> DwarfOps),
                     (Tag, Header, DwarfOps))
 
   /// \brief Return a (temporary) clone of this.
-  TempGenericDebugNode clone() const { return cloneImpl(); }
+  TempGenericDINode clone() const { return cloneImpl(); }
 
   unsigned getTag() const { return SubclassData16; }
   StringRef getHeader() const { return getStringOperand(0); }
@@ -308,7 +303,7 @@
   }
 
   static bool classof(const Metadata *MD) {
-    return MD->getMetadataID() == GenericDebugNodeKind;
+    return MD->getMetadataID() == GenericDINodeKind;
   }
 };
 
@@ -316,39 +311,38 @@
 ///
 /// TODO: Merge into node for DW_TAG_array_type, which should have a custom
 /// type.
-class MDSubrange : public DebugNode {
+class DISubrange : public DINode {
   friend class LLVMContextImpl;
   friend class MDNode;
 
   int64_t Count;
   int64_t LowerBound;
 
-  MDSubrange(LLVMContext &C, StorageType Storage, int64_t Count,
+  DISubrange(LLVMContext &C, StorageType Storage, int64_t Count,
              int64_t LowerBound)
-      : DebugNode(C, MDSubrangeKind, Storage, dwarf::DW_TAG_subrange_type,
-                  None),
+      : DINode(C, DISubrangeKind, Storage, dwarf::DW_TAG_subrange_type, None),
         Count(Count), LowerBound(LowerBound) {}
-  ~MDSubrange() = default;
+  ~DISubrange() = default;
 
-  static MDSubrange *getImpl(LLVMContext &Context, int64_t Count,
+  static DISubrange *getImpl(LLVMContext &Context, int64_t Count,
                              int64_t LowerBound, StorageType Storage,
                              bool ShouldCreate = true);
 
-  TempMDSubrange cloneImpl() const {
+  TempDISubrange cloneImpl() const {
     return getTemporary(getContext(), getCount(), getLowerBound());
   }
 
 public:
-  DEFINE_MDNODE_GET(MDSubrange, (int64_t Count, int64_t LowerBound = 0),
+  DEFINE_MDNODE_GET(DISubrange, (int64_t Count, int64_t LowerBound = 0),
                     (Count, LowerBound))
 
-  TempMDSubrange clone() const { return cloneImpl(); }
+  TempDISubrange clone() const { return cloneImpl(); }
 
   int64_t getLowerBound() const { return LowerBound; }
   int64_t getCount() const { return Count; }
 
   static bool classof(const Metadata *MD) {
-    return MD->getMetadataID() == MDSubrangeKind;
+    return MD->getMetadataID() == DISubrangeKind;
   }
 };
 
@@ -356,39 +350,39 @@
 ///
 /// TODO: Add a pointer to the context (DW_TAG_enumeration_type) once that no
 /// longer creates a type cycle.
-class MDEnumerator : public DebugNode {
+class DIEnumerator : public DINode {
   friend class LLVMContextImpl;
   friend class MDNode;
 
   int64_t Value;
 
-  MDEnumerator(LLVMContext &C, StorageType Storage, int64_t Value,
+  DIEnumerator(LLVMContext &C, StorageType Storage, int64_t Value,
                ArrayRef<Metadata *> Ops)
-      : DebugNode(C, MDEnumeratorKind, Storage, dwarf::DW_TAG_enumerator, Ops),
+      : DINode(C, DIEnumeratorKind, Storage, dwarf::DW_TAG_enumerator, Ops),
         Value(Value) {}
-  ~MDEnumerator() = default;
+  ~DIEnumerator() = default;
 
-  static MDEnumerator *getImpl(LLVMContext &Context, int64_t Value,
+  static DIEnumerator *getImpl(LLVMContext &Context, int64_t Value,
                                StringRef Name, StorageType Storage,
                                bool ShouldCreate = true) {
     return getImpl(Context, Value, getCanonicalMDString(Context, Name), Storage,
                    ShouldCreate);
   }
-  static MDEnumerator *getImpl(LLVMContext &Context, int64_t Value,
+  static DIEnumerator *getImpl(LLVMContext &Context, int64_t Value,
                                MDString *Name, StorageType Storage,
                                bool ShouldCreate = true);
 
-  TempMDEnumerator cloneImpl() const {
+  TempDIEnumerator cloneImpl() const {
     return getTemporary(getContext(), getValue(), getName());
   }
 
 public:
-  DEFINE_MDNODE_GET(MDEnumerator, (int64_t Value, StringRef Name),
+  DEFINE_MDNODE_GET(DIEnumerator, (int64_t Value, StringRef Name),
                     (Value, Name))
-  DEFINE_MDNODE_GET(MDEnumerator, (int64_t Value, MDString *Name),
+  DEFINE_MDNODE_GET(DIEnumerator, (int64_t Value, MDString *Name),
                     (Value, Name))
 
-  TempMDEnumerator clone() const { return cloneImpl(); }
+  TempDIEnumerator clone() const { return cloneImpl(); }
 
   int64_t getValue() const { return Value; }
   StringRef getName() const { return getStringOperand(0); }
@@ -396,7 +390,7 @@
   MDString *getRawName() const { return getOperandAs<MDString>(0); }
 
   static bool classof(const Metadata *MD) {
-    return MD->getMetadataID() == MDEnumeratorKind;
+    return MD->getMetadataID() == DIEnumeratorKind;
   }
 };
 
@@ -406,49 +400,49 @@
 /// contexts).
 ///
 /// TODO: Separate the concepts of declaration contexts and lexical scopes.
-class MDScope : public DebugNode {
+class DIScope : public DINode {
 protected:
-  MDScope(LLVMContext &C, unsigned ID, StorageType Storage, unsigned Tag,
+  DIScope(LLVMContext &C, unsigned ID, StorageType Storage, unsigned Tag,
           ArrayRef<Metadata *> Ops)
-      : DebugNode(C, ID, Storage, Tag, Ops) {}
-  ~MDScope() = default;
+      : DINode(C, ID, Storage, Tag, Ops) {}
+  ~DIScope() = default;
 
 public:
-  MDFile *getFile() const { return cast_or_null<MDFile>(getRawFile()); }
+  DIFile *getFile() const { return cast_or_null<DIFile>(getRawFile()); }
 
   inline StringRef getFilename() const;
   inline StringRef getDirectory() const;
 
   StringRef getName() const;
-  MDScopeRef getScope() const;
+  DIScopeRef getScope() const;
 
   /// \brief Return the raw underlying file.
   ///
-  /// An \a MDFile is an \a MDScope, but it doesn't point at a separate file
-  /// (it\em is the file).  If \c this is an \a MDFile, we need to return \c
+  /// An \a DIFile is an \a DIScope, but it doesn't point at a separate file
+  /// (it\em is the file).  If \c this is an \a DIFile, we need to return \c
   /// this.  Otherwise, return the first operand, which is where all other
   /// subclasses store their file pointer.
   Metadata *getRawFile() const {
-    return isa<MDFile>(this) ? const_cast<MDScope *>(this)
+    return isa<DIFile>(this) ? const_cast<DIScope *>(this)
                              : static_cast<Metadata *>(getOperand(0));
   }
 
-  MDScopeRef getRef() const { return MDScopeRef::get(this); }
+  DIScopeRef getRef() const { return DIScopeRef::get(this); }
 
   static bool classof(const Metadata *MD) {
     switch (MD->getMetadataID()) {
     default:
       return false;
-    case MDBasicTypeKind:
-    case MDDerivedTypeKind:
-    case MDCompositeTypeKind:
-    case MDSubroutineTypeKind:
-    case MDFileKind:
-    case MDCompileUnitKind:
-    case MDSubprogramKind:
-    case MDLexicalBlockKind:
-    case MDLexicalBlockFileKind:
-    case MDNamespaceKind:
+    case DIBasicTypeKind:
+    case DIDerivedTypeKind:
+    case DICompositeTypeKind:
+    case DISubroutineTypeKind:
+    case DIFileKind:
+    case DICompileUnitKind:
+    case DISubprogramKind:
+    case DILexicalBlockKind:
+    case DILexicalBlockFileKind:
+    case DINamespaceKind:
       return true;
     }
   }
@@ -458,36 +452,36 @@
 ///
 /// TODO: Merge with directory/file node (including users).
 /// TODO: Canonicalize paths on creation.
-class MDFile : public MDScope {
+class DIFile : public DIScope {
   friend class LLVMContextImpl;
   friend class MDNode;
 
-  MDFile(LLVMContext &C, StorageType Storage, ArrayRef<Metadata *> Ops)
-      : MDScope(C, MDFileKind, Storage, dwarf::DW_TAG_file_type, Ops) {}
-  ~MDFile() = default;
+  DIFile(LLVMContext &C, StorageType Storage, ArrayRef<Metadata *> Ops)
+      : DIScope(C, DIFileKind, Storage, dwarf::DW_TAG_file_type, Ops) {}
+  ~DIFile() = default;
 
-  static MDFile *getImpl(LLVMContext &Context, StringRef Filename,
+  static DIFile *getImpl(LLVMContext &Context, StringRef Filename,
                          StringRef Directory, StorageType Storage,
                          bool ShouldCreate = true) {
     return getImpl(Context, getCanonicalMDString(Context, Filename),
                    getCanonicalMDString(Context, Directory), Storage,
                    ShouldCreate);
   }
-  static MDFile *getImpl(LLVMContext &Context, MDString *Filename,
+  static DIFile *getImpl(LLVMContext &Context, MDString *Filename,
                          MDString *Directory, StorageType Storage,
                          bool ShouldCreate = true);
 
-  TempMDFile cloneImpl() const {
+  TempDIFile cloneImpl() const {
     return getTemporary(getContext(), getFilename(), getDirectory());
   }
 
 public:
-  DEFINE_MDNODE_GET(MDFile, (StringRef Filename, StringRef Directory),
+  DEFINE_MDNODE_GET(DIFile, (StringRef Filename, StringRef Directory),
                     (Filename, Directory))
-  DEFINE_MDNODE_GET(MDFile, (MDString * Filename, MDString *Directory),
+  DEFINE_MDNODE_GET(DIFile, (MDString * Filename, MDString *Directory),
                     (Filename, Directory))
 
-  TempMDFile clone() const { return cloneImpl(); }
+  TempDIFile clone() const { return cloneImpl(); }
 
   StringRef getFilename() const { return getStringOperand(0); }
   StringRef getDirectory() const { return getStringOperand(1); }
@@ -496,17 +490,17 @@
   MDString *getRawDirectory() const { return getOperandAs<MDString>(1); }
 
   static bool classof(const Metadata *MD) {
-    return MD->getMetadataID() == MDFileKind;
+    return MD->getMetadataID() == DIFileKind;
   }
 };
 
-StringRef MDScope::getFilename() const {
+StringRef DIScope::getFilename() const {
   if (auto *F = getFile())
     return F->getFilename();
   return "";
 }
 
-StringRef MDScope::getDirectory() const {
+StringRef DIScope::getDirectory() const {
   if (auto *F = getFile())
     return F->getDirectory();
   return "";
@@ -517,7 +511,7 @@
 /// TODO: Remove the hardcoded name and context, since many types don't use
 /// them.
 /// TODO: Split up flags.
-class MDType : public MDScope {
+class DIType : public DIScope {
   unsigned Line;
   unsigned Flags;
   uint64_t SizeInBits;
@@ -525,17 +519,17 @@
   uint64_t OffsetInBits;
 
 protected:
-  MDType(LLVMContext &C, unsigned ID, StorageType Storage, unsigned Tag,
+  DIType(LLVMContext &C, unsigned ID, StorageType Storage, unsigned Tag,
          unsigned Line, uint64_t SizeInBits, uint64_t AlignInBits,
          uint64_t OffsetInBits, unsigned Flags, ArrayRef<Metadata *> Ops)
-      : MDScope(C, ID, Storage, Tag, Ops), Line(Line), Flags(Flags),
+      : DIScope(C, ID, Storage, Tag, Ops), Line(Line), Flags(Flags),
         SizeInBits(SizeInBits), AlignInBits(AlignInBits),
         OffsetInBits(OffsetInBits) {}
-  ~MDType() = default;
+  ~DIType() = default;
 
 public:
-  TempMDType clone() const {
-    return TempMDType(cast<MDType>(MDNode::clone().release()));
+  TempDIType clone() const {
+    return TempDIType(cast<DIType>(MDNode::clone().release()));
   }
 
   unsigned getLine() const { return Line; }
@@ -544,7 +538,7 @@
   uint64_t getOffsetInBits() const { return OffsetInBits; }
   unsigned getFlags() const { return Flags; }
 
-  MDScopeRef getScope() const { return MDScopeRef(getRawScope()); }
+  DIScopeRef getScope() const { return DIScopeRef(getRawScope()); }
   StringRef getName() const { return getStringOperand(2); }
 
 
@@ -579,16 +573,16 @@
   bool isLValueReference() const { return getFlags() & FlagLValueReference; }
   bool isRValueReference() const { return getFlags() & FlagRValueReference; }
 
-  MDTypeRef getRef() const { return MDTypeRef::get(this); }
+  DITypeRef getRef() const { return DITypeRef::get(this); }
 
   static bool classof(const Metadata *MD) {
     switch (MD->getMetadataID()) {
     default:
       return false;
-    case MDBasicTypeKind:
-    case MDDerivedTypeKind:
-    case MDCompositeTypeKind:
-    case MDSubroutineTypeKind:
+    case DIBasicTypeKind:
+    case DIDerivedTypeKind:
+    case DICompositeTypeKind:
+    case DISubroutineTypeKind:
       return true;
     }
   }
@@ -598,79 +592,79 @@
 ///
 /// TODO: Split out DW_TAG_unspecified_type.
 /// TODO: Drop unused accessors.
-class MDBasicType : public MDType {
+class DIBasicType : public DIType {
   friend class LLVMContextImpl;
   friend class MDNode;
 
   unsigned Encoding;
 
-  MDBasicType(LLVMContext &C, StorageType Storage, unsigned Tag,
+  DIBasicType(LLVMContext &C, StorageType Storage, unsigned Tag,
               uint64_t SizeInBits, uint64_t AlignInBits, unsigned Encoding,
               ArrayRef<Metadata *> Ops)
-      : MDType(C, MDBasicTypeKind, Storage, Tag, 0, SizeInBits, AlignInBits, 0,
+      : DIType(C, DIBasicTypeKind, Storage, Tag, 0, SizeInBits, AlignInBits, 0,
                0, Ops),
         Encoding(Encoding) {}
-  ~MDBasicType() = default;
+  ~DIBasicType() = default;
 
-  static MDBasicType *getImpl(LLVMContext &Context, unsigned Tag,
+  static DIBasicType *getImpl(LLVMContext &Context, unsigned Tag,
                               StringRef Name, uint64_t SizeInBits,
                               uint64_t AlignInBits, unsigned Encoding,
                               StorageType Storage, bool ShouldCreate = true) {
     return getImpl(Context, Tag, getCanonicalMDString(Context, Name),
                    SizeInBits, AlignInBits, Encoding, Storage, ShouldCreate);
   }
-  static MDBasicType *getImpl(LLVMContext &Context, unsigned Tag,
+  static DIBasicType *getImpl(LLVMContext &Context, unsigned Tag,
                               MDString *Name, uint64_t SizeInBits,
                               uint64_t AlignInBits, unsigned Encoding,
                               StorageType Storage, bool ShouldCreate = true);
 
-  TempMDBasicType cloneImpl() const {
+  TempDIBasicType cloneImpl() const {
     return getTemporary(getContext(), getTag(), getName(), getSizeInBits(),
                         getAlignInBits(), getEncoding());
   }
 
 public:
-  DEFINE_MDNODE_GET(MDBasicType, (unsigned Tag, StringRef Name),
+  DEFINE_MDNODE_GET(DIBasicType, (unsigned Tag, StringRef Name),
                     (Tag, Name, 0, 0, 0))
-  DEFINE_MDNODE_GET(MDBasicType,
+  DEFINE_MDNODE_GET(DIBasicType,
                     (unsigned Tag, StringRef Name, uint64_t SizeInBits,
                      uint64_t AlignInBits, unsigned Encoding),
                     (Tag, Name, SizeInBits, AlignInBits, Encoding))
-  DEFINE_MDNODE_GET(MDBasicType,
+  DEFINE_MDNODE_GET(DIBasicType,
                     (unsigned Tag, MDString *Name, uint64_t SizeInBits,
                      uint64_t AlignInBits, unsigned Encoding),
                     (Tag, Name, SizeInBits, AlignInBits, Encoding))
 
-  TempMDBasicType clone() const { return cloneImpl(); }
+  TempDIBasicType clone() const { return cloneImpl(); }
 
   unsigned getEncoding() const { return Encoding; }
 
   static bool classof(const Metadata *MD) {
-    return MD->getMetadataID() == MDBasicTypeKind;
+    return MD->getMetadataID() == DIBasicTypeKind;
   }
 };
 
-/// \brief Base class for MDDerivedType and MDCompositeType.
+/// \brief Base class for DIDerivedType and DICompositeType.
 ///
 /// TODO: Delete; they're not really related.
-class MDDerivedTypeBase : public MDType {
+class DIDerivedTypeBase : public DIType {
 protected:
-  MDDerivedTypeBase(LLVMContext &C, unsigned ID, StorageType Storage,
+  DIDerivedTypeBase(LLVMContext &C, unsigned ID, StorageType Storage,
                     unsigned Tag, unsigned Line, uint64_t SizeInBits,
                     uint64_t AlignInBits, uint64_t OffsetInBits, unsigned Flags,
                     ArrayRef<Metadata *> Ops)
-      : MDType(C, ID, Storage, Tag, Line, SizeInBits, AlignInBits, OffsetInBits,
+      : DIType(C, ID, Storage, Tag, Line, SizeInBits, AlignInBits, OffsetInBits,
                Flags, Ops) {}
-  ~MDDerivedTypeBase() = default;
+  ~DIDerivedTypeBase() = default;
 
 public:
-  MDTypeRef getBaseType() const { return MDTypeRef(getRawBaseType()); }
+  DITypeRef getBaseType() const { return DITypeRef(getRawBaseType()); }
   Metadata *getRawBaseType() const { return getOperand(3); }
 
   static bool classof(const Metadata *MD) {
-    return MD->getMetadataID() == MDDerivedTypeKind ||
-           MD->getMetadataID() == MDCompositeTypeKind ||
-           MD->getMetadataID() == MDSubroutineTypeKind;
+    return MD->getMetadataID() == DIDerivedTypeKind ||
+           MD->getMetadataID() == DICompositeTypeKind ||
+           MD->getMetadataID() == DISubroutineTypeKind;
   }
 };
 
@@ -680,20 +674,20 @@
 /// class members.
 ///
 /// TODO: Split out members (inheritance, fields, methods, etc.).
-class MDDerivedType : public MDDerivedTypeBase {
+class DIDerivedType : public DIDerivedTypeBase {
   friend class LLVMContextImpl;
   friend class MDNode;
 
-  MDDerivedType(LLVMContext &C, StorageType Storage, unsigned Tag,
+  DIDerivedType(LLVMContext &C, StorageType Storage, unsigned Tag,
                 unsigned Line, uint64_t SizeInBits, uint64_t AlignInBits,
                 uint64_t OffsetInBits, unsigned Flags, ArrayRef<Metadata *> Ops)
-      : MDDerivedTypeBase(C, MDDerivedTypeKind, Storage, Tag, Line, SizeInBits,
+      : DIDerivedTypeBase(C, DIDerivedTypeKind, Storage, Tag, Line, SizeInBits,
                           AlignInBits, OffsetInBits, Flags, Ops) {}
-  ~MDDerivedType() = default;
+  ~DIDerivedType() = default;
 
-  static MDDerivedType *getImpl(LLVMContext &Context, unsigned Tag,
-                                StringRef Name, MDFile *File, unsigned Line,
-                                MDScopeRef Scope, MDTypeRef BaseType,
+  static DIDerivedType *getImpl(LLVMContext &Context, unsigned Tag,
+                                StringRef Name, DIFile *File, unsigned Line,
+                                DIScopeRef Scope, DITypeRef BaseType,
                                 uint64_t SizeInBits, uint64_t AlignInBits,
                                 uint64_t OffsetInBits, unsigned Flags,
                                 Metadata *ExtraData, StorageType Storage,
@@ -702,7 +696,7 @@
                    Line, Scope, BaseType, SizeInBits, AlignInBits, OffsetInBits,
                    Flags, ExtraData, Storage, ShouldCreate);
   }
-  static MDDerivedType *getImpl(LLVMContext &Context, unsigned Tag,
+  static DIDerivedType *getImpl(LLVMContext &Context, unsigned Tag,
                                 MDString *Name, Metadata *File, unsigned Line,
                                 Metadata *Scope, Metadata *BaseType,
                                 uint64_t SizeInBits, uint64_t AlignInBits,
@@ -710,7 +704,7 @@
                                 Metadata *ExtraData, StorageType Storage,
                                 bool ShouldCreate = true);
 
-  TempMDDerivedType cloneImpl() const {
+  TempDIDerivedType cloneImpl() const {
     return getTemporary(getContext(), getTag(), getName(), getFile(), getLine(),
                         getScope(), getBaseType(), getSizeInBits(),
                         getAlignInBits(), getOffsetInBits(), getFlags(),
@@ -718,7 +712,7 @@
   }
 
 public:
-  DEFINE_MDNODE_GET(MDDerivedType,
+  DEFINE_MDNODE_GET(DIDerivedType,
                     (unsigned Tag, MDString *Name, Metadata *File,
                      unsigned Line, Metadata *Scope, Metadata *BaseType,
                      uint64_t SizeInBits, uint64_t AlignInBits,
@@ -726,15 +720,15 @@
                      Metadata *ExtraData = nullptr),
                     (Tag, Name, File, Line, Scope, BaseType, SizeInBits,
                      AlignInBits, OffsetInBits, Flags, ExtraData))
-  DEFINE_MDNODE_GET(MDDerivedType,
-                    (unsigned Tag, StringRef Name, MDFile *File, unsigned Line,
-                     MDScopeRef Scope, MDTypeRef BaseType, uint64_t SizeInBits,
+  DEFINE_MDNODE_GET(DIDerivedType,
+                    (unsigned Tag, StringRef Name, DIFile *File, unsigned Line,
+                     DIScopeRef Scope, DITypeRef BaseType, uint64_t SizeInBits,
                      uint64_t AlignInBits, uint64_t OffsetInBits,
                      unsigned Flags, Metadata *ExtraData = nullptr),
                     (Tag, Name, File, Line, Scope, BaseType, SizeInBits,
                      AlignInBits, OffsetInBits, Flags, ExtraData))
 
-  TempMDDerivedType clone() const { return cloneImpl(); }
+  TempDIDerivedType clone() const { return cloneImpl(); }
 
   /// \brief Get extra data associated with this derived type.
   ///
@@ -748,12 +742,12 @@
 
   /// \brief Get casted version of extra data.
   /// @{
-  MDTypeRef getClassType() const {
+  DITypeRef getClassType() const {
     assert(getTag() == dwarf::DW_TAG_ptr_to_member_type);
-    return MDTypeRef(getExtraData());
+    return DITypeRef(getExtraData());
   }
-  MDObjCProperty *getObjCProperty() const {
-    return dyn_cast_or_null<MDObjCProperty>(getExtraData());
+  DIObjCProperty *getObjCProperty() const {
+    return dyn_cast_or_null<DIObjCProperty>(getExtraData());
   }
   Constant *getConstant() const {
     assert(getTag() == dwarf::DW_TAG_member && isStaticMember());
@@ -764,39 +758,39 @@
   /// @}
 
   static bool classof(const Metadata *MD) {
-    return MD->getMetadataID() == MDDerivedTypeKind;
+    return MD->getMetadataID() == DIDerivedTypeKind;
   }
 };
 
-/// \brief Base class for MDCompositeType and MDSubroutineType.
+/// \brief Base class for DICompositeType and DISubroutineType.
 ///
 /// TODO: Delete; they're not really related.
-class MDCompositeTypeBase : public MDDerivedTypeBase {
+class DICompositeTypeBase : public DIDerivedTypeBase {
   unsigned RuntimeLang;
 
 protected:
-  MDCompositeTypeBase(LLVMContext &C, unsigned ID, StorageType Storage,
+  DICompositeTypeBase(LLVMContext &C, unsigned ID, StorageType Storage,
                       unsigned Tag, unsigned Line, unsigned RuntimeLang,
                       uint64_t SizeInBits, uint64_t AlignInBits,
                       uint64_t OffsetInBits, unsigned Flags,
                       ArrayRef<Metadata *> Ops)
-      : MDDerivedTypeBase(C, ID, Storage, Tag, Line, SizeInBits, AlignInBits,
+      : DIDerivedTypeBase(C, ID, Storage, Tag, Line, SizeInBits, AlignInBits,
                           OffsetInBits, Flags, Ops),
         RuntimeLang(RuntimeLang) {}
-  ~MDCompositeTypeBase() = default;
+  ~DICompositeTypeBase() = default;
 
 public:
   /// \brief Get the elements of the composite type.
   ///
-  /// \note Calling this is only valid for \a MDCompositeType.  This assertion
-  /// can be removed once \a MDSubroutineType has been separated from
+  /// \note Calling this is only valid for \a DICompositeType.  This assertion
+  /// can be removed once \a DISubroutineType has been separated from
   /// "composite types".
-  DebugNodeArray getElements() const {
-    assert(!isa<MDSubroutineType>(this) && "no elements for DISubroutineType");
+  DINodeArray getElements() const {
+    assert(!isa<DISubroutineType>(this) && "no elements for DISubroutineType");
     return cast_or_null<MDTuple>(getRawElements());
   }
-  MDTypeRef getVTableHolder() const { return MDTypeRef(getRawVTableHolder()); }
-  MDTemplateParameterArray getTemplateParams() const {
+  DITypeRef getVTableHolder() const { return DITypeRef(getRawVTableHolder()); }
+  DITemplateParameterArray getTemplateParams() const {
     return cast_or_null<MDTuple>(getRawTemplateParams());
   }
   StringRef getIdentifier() const { return getStringOperand(7); }
@@ -813,25 +807,25 @@
   /// this will be RAUW'ed and deleted.  Use a \a TrackingMDRef to keep track
   /// of its movement if necessary.
   /// @{
-  void replaceElements(DebugNodeArray Elements) {
+  void replaceElements(DINodeArray Elements) {
 #ifndef NDEBUG
-    for (DebugNode *Op : getElements())
+    for (DINode *Op : getElements())
       assert(std::find(Elements->op_begin(), Elements->op_end(), Op) &&
              "Lost a member during member list replacement");
 #endif
     replaceOperandWith(4, Elements.get());
   }
-  void replaceVTableHolder(MDTypeRef VTableHolder) {
+  void replaceVTableHolder(DITypeRef VTableHolder) {
     replaceOperandWith(5, VTableHolder);
   }
-  void replaceTemplateParams(MDTemplateParameterArray TemplateParams) {
+  void replaceTemplateParams(DITemplateParameterArray TemplateParams) {
     replaceOperandWith(6, TemplateParams.get());
   }
   /// @}
 
   static bool classof(const Metadata *MD) {
-    return MD->getMetadataID() == MDCompositeTypeKind ||
-           MD->getMetadataID() == MDSubroutineTypeKind;
+    return MD->getMetadataID() == DICompositeTypeKind ||
+           MD->getMetadataID() == DISubroutineTypeKind;
   }
 };
 
@@ -839,25 +833,25 @@
 ///
 /// TODO: Detach from DerivedTypeBase (split out MDEnumType?).
 /// TODO: Create a custom, unrelated node for DW_TAG_array_type.
-class MDCompositeType : public MDCompositeTypeBase {
+class DICompositeType : public DICompositeTypeBase {
   friend class LLVMContextImpl;
   friend class MDNode;
 
-  MDCompositeType(LLVMContext &C, StorageType Storage, unsigned Tag,
+  DICompositeType(LLVMContext &C, StorageType Storage, unsigned Tag,
                   unsigned Line, unsigned RuntimeLang, uint64_t SizeInBits,
                   uint64_t AlignInBits, uint64_t OffsetInBits, unsigned Flags,
                   ArrayRef<Metadata *> Ops)
-      : MDCompositeTypeBase(C, MDCompositeTypeKind, Storage, Tag, Line,
+      : DICompositeTypeBase(C, DICompositeTypeKind, Storage, Tag, Line,
                             RuntimeLang, SizeInBits, AlignInBits, OffsetInBits,
                             Flags, Ops) {}
-  ~MDCompositeType() = default;
+  ~DICompositeType() = default;
 
-  static MDCompositeType *
+  static DICompositeType *
   getImpl(LLVMContext &Context, unsigned Tag, StringRef Name, Metadata *File,
-          unsigned Line, MDScopeRef Scope, MDTypeRef BaseType,
+          unsigned Line, DIScopeRef Scope, DITypeRef BaseType,
           uint64_t SizeInBits, uint64_t AlignInBits, uint64_t OffsetInBits,
-          uint64_t Flags, DebugNodeArray Elements, unsigned RuntimeLang,
-          MDTypeRef VTableHolder, MDTemplateParameterArray TemplateParams,
+          uint64_t Flags, DINodeArray Elements, unsigned RuntimeLang,
+          DITypeRef VTableHolder, DITemplateParameterArray TemplateParams,
           StringRef Identifier, StorageType Storage, bool ShouldCreate = true) {
     return getImpl(
         Context, Tag, getCanonicalMDString(Context, Name), File, Line, Scope,
@@ -865,7 +859,7 @@
         RuntimeLang, VTableHolder, TemplateParams.get(),
         getCanonicalMDString(Context, Identifier), Storage, ShouldCreate);
   }
-  static MDCompositeType *
+  static DICompositeType *
   getImpl(LLVMContext &Context, unsigned Tag, MDString *Name, Metadata *File,
           unsigned Line, Metadata *Scope, Metadata *BaseType,
           uint64_t SizeInBits, uint64_t AlignInBits, uint64_t OffsetInBits,
@@ -873,7 +867,7 @@
           Metadata *VTableHolder, Metadata *TemplateParams,
           MDString *Identifier, StorageType Storage, bool ShouldCreate = true);
 
-  TempMDCompositeType cloneImpl() const {
+  TempDICompositeType cloneImpl() const {
     return getTemporary(getContext(), getTag(), getName(), getFile(), getLine(),
                         getScope(), getBaseType(), getSizeInBits(),
                         getAlignInBits(), getOffsetInBits(), getFlags(),
@@ -882,18 +876,18 @@
   }
 
 public:
-  DEFINE_MDNODE_GET(MDCompositeType,
-                    (unsigned Tag, StringRef Name, MDFile *File, unsigned Line,
-                     MDScopeRef Scope, MDTypeRef BaseType, uint64_t SizeInBits,
+  DEFINE_MDNODE_GET(DICompositeType,
+                    (unsigned Tag, StringRef Name, DIFile *File, unsigned Line,
+                     DIScopeRef Scope, DITypeRef BaseType, uint64_t SizeInBits,
                      uint64_t AlignInBits, uint64_t OffsetInBits,
-                     unsigned Flags, DebugNodeArray Elements,
-                     unsigned RuntimeLang, MDTypeRef VTableHolder,
-                     MDTemplateParameterArray TemplateParams = nullptr,
+                     unsigned Flags, DINodeArray Elements, unsigned RuntimeLang,
+                     DITypeRef VTableHolder,
+                     DITemplateParameterArray TemplateParams = nullptr,
                      StringRef Identifier = ""),
                     (Tag, Name, File, Line, Scope, BaseType, SizeInBits,
                      AlignInBits, OffsetInBits, Flags, Elements, RuntimeLang,
                      VTableHolder, TemplateParams, Identifier))
-  DEFINE_MDNODE_GET(MDCompositeType,
+  DEFINE_MDNODE_GET(DICompositeType,
                     (unsigned Tag, MDString *Name, Metadata *File,
                      unsigned Line, Metadata *Scope, Metadata *BaseType,
                      uint64_t SizeInBits, uint64_t AlignInBits,
@@ -905,71 +899,71 @@
                      AlignInBits, OffsetInBits, Flags, Elements, RuntimeLang,
                      VTableHolder, TemplateParams, Identifier))
 
-  TempMDCompositeType clone() const { return cloneImpl(); }
+  TempDICompositeType clone() const { return cloneImpl(); }
 
   static bool classof(const Metadata *MD) {
-    return MD->getMetadataID() == MDCompositeTypeKind;
+    return MD->getMetadataID() == DICompositeTypeKind;
   }
 };
 
-template <class T> TypedDebugNodeRef<T> TypedDebugNodeRef<T>::get(const T *N) {
+template <class T> TypedDINodeRef<T> TypedDINodeRef<T>::get(const T *N) {
   if (N)
-    if (auto *Composite = dyn_cast<MDCompositeType>(N))
+    if (auto *Composite = dyn_cast<DICompositeType>(N))
       if (auto *S = Composite->getRawIdentifier())
-        return TypedDebugNodeRef<T>(S);
-  return TypedDebugNodeRef<T>(N);
+        return TypedDINodeRef<T>(S);
+  return TypedDINodeRef<T>(N);
 }
 
 /// \brief Type array for a subprogram.
 ///
 /// TODO: Detach from CompositeType, and fold the array of types in directly
 /// as operands.
-class MDSubroutineType : public MDCompositeTypeBase {
+class DISubroutineType : public DICompositeTypeBase {
   friend class LLVMContextImpl;
   friend class MDNode;
 
-  MDSubroutineType(LLVMContext &C, StorageType Storage, unsigned Flags,
+  DISubroutineType(LLVMContext &C, StorageType Storage, unsigned Flags,
                    ArrayRef<Metadata *> Ops)
-      : MDCompositeTypeBase(C, MDSubroutineTypeKind, Storage,
+      : DICompositeTypeBase(C, DISubroutineTypeKind, Storage,
                             dwarf::DW_TAG_subroutine_type, 0, 0, 0, 0, 0, Flags,
                             Ops) {}
-  ~MDSubroutineType() = default;
+  ~DISubroutineType() = default;
 
-  static MDSubroutineType *getImpl(LLVMContext &Context, unsigned Flags,
-                                   MDTypeRefArray TypeArray,
+  static DISubroutineType *getImpl(LLVMContext &Context, unsigned Flags,
+                                   DITypeRefArray TypeArray,
                                    StorageType Storage,
                                    bool ShouldCreate = true) {
     return getImpl(Context, Flags, TypeArray.get(), Storage, ShouldCreate);
   }
-  static MDSubroutineType *getImpl(LLVMContext &Context, unsigned Flags,
+  static DISubroutineType *getImpl(LLVMContext &Context, unsigned Flags,
                                    Metadata *TypeArray, StorageType Storage,
                                    bool ShouldCreate = true);
 
-  TempMDSubroutineType cloneImpl() const {
+  TempDISubroutineType cloneImpl() const {
     return getTemporary(getContext(), getFlags(), getTypeArray());
   }
 
 public:
-  DEFINE_MDNODE_GET(MDSubroutineType,
-                    (unsigned Flags, MDTypeRefArray TypeArray),
+  DEFINE_MDNODE_GET(DISubroutineType,
+                    (unsigned Flags, DITypeRefArray TypeArray),
                     (Flags, TypeArray))
-  DEFINE_MDNODE_GET(MDSubroutineType, (unsigned Flags, Metadata *TypeArray),
+  DEFINE_MDNODE_GET(DISubroutineType, (unsigned Flags, Metadata *TypeArray),
                     (Flags, TypeArray))
 
-  TempMDSubroutineType clone() const { return cloneImpl(); }
+  TempDISubroutineType clone() const { return cloneImpl(); }
 
-  MDTypeRefArray getTypeArray() const {
+  DITypeRefArray getTypeArray() const {
     return cast_or_null<MDTuple>(getRawTypeArray());
   }
   Metadata *getRawTypeArray() const { return getRawElements(); }
 
   static bool classof(const Metadata *MD) {
-    return MD->getMetadataID() == MDSubroutineTypeKind;
+    return MD->getMetadataID() == DISubroutineTypeKind;
   }
 };
 
 /// \brief Compile unit.
-class MDCompileUnit : public MDScope {
+class DICompileUnit : public DIScope {
   friend class LLVMContextImpl;
   friend class MDNode;
 
@@ -978,22 +972,22 @@
   unsigned RuntimeVersion;
   unsigned EmissionKind;
 
-  MDCompileUnit(LLVMContext &C, StorageType Storage, unsigned SourceLanguage,
+  DICompileUnit(LLVMContext &C, StorageType Storage, unsigned SourceLanguage,
                 bool IsOptimized, unsigned RuntimeVersion,
                 unsigned EmissionKind, ArrayRef<Metadata *> Ops)
-      : MDScope(C, MDCompileUnitKind, Storage, dwarf::DW_TAG_compile_unit, Ops),
+      : DIScope(C, DICompileUnitKind, Storage, dwarf::DW_TAG_compile_unit, Ops),
         SourceLanguage(SourceLanguage), IsOptimized(IsOptimized),
         RuntimeVersion(RuntimeVersion), EmissionKind(EmissionKind) {}
-  ~MDCompileUnit() = default;
+  ~DICompileUnit() = default;
 
-  static MDCompileUnit *
-  getImpl(LLVMContext &Context, unsigned SourceLanguage, MDFile *File,
+  static DICompileUnit *
+  getImpl(LLVMContext &Context, unsigned SourceLanguage, DIFile *File,
           StringRef Producer, bool IsOptimized, StringRef Flags,
           unsigned RuntimeVersion, StringRef SplitDebugFilename,
-          unsigned EmissionKind, MDCompositeTypeArray EnumTypes,
-          MDTypeArray RetainedTypes, MDSubprogramArray Subprograms,
-          MDGlobalVariableArray GlobalVariables,
-          MDImportedEntityArray ImportedEntities, StorageType Storage,
+          unsigned EmissionKind, DICompositeTypeArray EnumTypes,
+          DITypeArray RetainedTypes, DISubprogramArray Subprograms,
+          DIGlobalVariableArray GlobalVariables,
+          DIImportedEntityArray ImportedEntities, StorageType Storage,
           bool ShouldCreate = true) {
     return getImpl(
         Context, SourceLanguage, File, getCanonicalMDString(Context, Producer),
@@ -1002,7 +996,7 @@
         EnumTypes.get(), RetainedTypes.get(), Subprograms.get(),
         GlobalVariables.get(), ImportedEntities.get(), Storage, ShouldCreate);
   }
-  static MDCompileUnit *
+  static DICompileUnit *
   getImpl(LLVMContext &Context, unsigned SourceLanguage, Metadata *File,
           MDString *Producer, bool IsOptimized, MDString *Flags,
           unsigned RuntimeVersion, MDString *SplitDebugFilename,
@@ -1011,7 +1005,7 @@
           Metadata *ImportedEntities, StorageType Storage,
           bool ShouldCreate = true);
 
-  TempMDCompileUnit cloneImpl() const {
+  TempDICompileUnit cloneImpl() const {
     return getTemporary(
         getContext(), getSourceLanguage(), getFile(), getProducer(),
         isOptimized(), getFlags(), getRuntimeVersion(), getSplitDebugFilename(),
@@ -1020,19 +1014,19 @@
   }
 
 public:
-  DEFINE_MDNODE_GET(MDCompileUnit,
-                    (unsigned SourceLanguage, MDFile *File, StringRef Producer,
+  DEFINE_MDNODE_GET(DICompileUnit,
+                    (unsigned SourceLanguage, DIFile *File, StringRef Producer,
                      bool IsOptimized, StringRef Flags, unsigned RuntimeVersion,
                      StringRef SplitDebugFilename, unsigned EmissionKind,
-                     MDCompositeTypeArray EnumTypes, MDTypeArray RetainedTypes,
-                     MDSubprogramArray Subprograms,
-                     MDGlobalVariableArray GlobalVariables,
-                     MDImportedEntityArray ImportedEntities),
+                     DICompositeTypeArray EnumTypes, DITypeArray RetainedTypes,
+                     DISubprogramArray Subprograms,
+                     DIGlobalVariableArray GlobalVariables,
+                     DIImportedEntityArray ImportedEntities),
                     (SourceLanguage, File, Producer, IsOptimized, Flags,
                      RuntimeVersion, SplitDebugFilename, EmissionKind,
                      EnumTypes, RetainedTypes, Subprograms, GlobalVariables,
                      ImportedEntities))
-  DEFINE_MDNODE_GET(MDCompileUnit,
+  DEFINE_MDNODE_GET(DICompileUnit,
                     (unsigned SourceLanguage, Metadata *File,
                      MDString *Producer, bool IsOptimized, MDString *Flags,
                      unsigned RuntimeVersion, MDString *SplitDebugFilename,
@@ -1044,7 +1038,7 @@
                      EnumTypes, RetainedTypes, Subprograms, GlobalVariables,
                      ImportedEntities))
 
-  TempMDCompileUnit clone() const { return cloneImpl(); }
+  TempDICompileUnit clone() const { return cloneImpl(); }
 
   unsigned getSourceLanguage() const { return SourceLanguage; }
   bool isOptimized() const { return IsOptimized; }
@@ -1053,19 +1047,19 @@
   StringRef getProducer() const { return getStringOperand(1); }
   StringRef getFlags() const { return getStringOperand(2); }
   StringRef getSplitDebugFilename() const { return getStringOperand(3); }
-  MDCompositeTypeArray getEnumTypes() const {
+  DICompositeTypeArray getEnumTypes() const {
     return cast_or_null<MDTuple>(getRawEnumTypes());
   }
-  MDTypeArray getRetainedTypes() const {
+  DITypeArray getRetainedTypes() const {
     return cast_or_null<MDTuple>(getRawRetainedTypes());
   }
-  MDSubprogramArray getSubprograms() const {
+  DISubprogramArray getSubprograms() const {
     return cast_or_null<MDTuple>(getRawSubprograms());
   }
-  MDGlobalVariableArray getGlobalVariables() const {
+  DIGlobalVariableArray getGlobalVariables() const {
     return cast_or_null<MDTuple>(getRawGlobalVariables());
   }
-  MDImportedEntityArray getImportedEntities() const {
+  DIImportedEntityArray getImportedEntities() const {
     return cast_or_null<MDTuple>(getRawImportedEntities());
   }
 
@@ -1084,71 +1078,71 @@
   ///
   /// If this \a isUniqued() and not \a isResolved(), it will be RAUW'ed and
   /// deleted on a uniquing collision.  In practice, uniquing collisions on \a
-  /// MDCompileUnit should be fairly rare.
+  /// DICompileUnit should be fairly rare.
   /// @{
-  void replaceSubprograms(MDSubprogramArray N) {
+  void replaceSubprograms(DISubprogramArray N) {
     replaceOperandWith(6, N.get());
   }
-  void replaceGlobalVariables(MDGlobalVariableArray N) {
+  void replaceGlobalVariables(DIGlobalVariableArray N) {
     replaceOperandWith(7, N.get());
   }
   /// @}
 
   static bool classof(const Metadata *MD) {
-    return MD->getMetadataID() == MDCompileUnitKind;
+    return MD->getMetadataID() == DICompileUnitKind;
   }
 };
 
 /// \brief A scope for locals.
 ///
 /// A legal scope for lexical blocks, local variables, and debug info
-/// locations.  Subclasses are \a MDSubprogram, \a MDLexicalBlock, and \a
-/// MDLexicalBlockFile.
-class MDLocalScope : public MDScope {
+/// locations.  Subclasses are \a DISubprogram, \a DILexicalBlock, and \a
+/// DILexicalBlockFile.
+class DILocalScope : public DIScope {
 protected:
-  MDLocalScope(LLVMContext &C, unsigned ID, StorageType Storage, unsigned Tag,
+  DILocalScope(LLVMContext &C, unsigned ID, StorageType Storage, unsigned Tag,
                ArrayRef<Metadata *> Ops)
-      : MDScope(C, ID, Storage, Tag, Ops) {}
-  ~MDLocalScope() = default;
+      : DIScope(C, ID, Storage, Tag, Ops) {}
+  ~DILocalScope() = default;
 
 public:
   /// \brief Get the subprogram for this scope.
   ///
-  /// Return this if it's an \a MDSubprogram; otherwise, look up the scope
+  /// Return this if it's an \a DISubprogram; otherwise, look up the scope
   /// chain.
-  MDSubprogram *getSubprogram() const;
+  DISubprogram *getSubprogram() const;
 
   static bool classof(const Metadata *MD) {
-    return MD->getMetadataID() == MDSubprogramKind ||
-           MD->getMetadataID() == MDLexicalBlockKind ||
-           MD->getMetadataID() == MDLexicalBlockFileKind;
+    return MD->getMetadataID() == DISubprogramKind ||
+           MD->getMetadataID() == DILexicalBlockKind ||
+           MD->getMetadataID() == DILexicalBlockFileKind;
   }
 };
 
 /// \brief Debug location.
 ///
 /// A debug location in source code, used for debug info and otherwise.
-class MDLocation : public MDNode {
+class DILocation : public MDNode {
   friend class LLVMContextImpl;
   friend class MDNode;
 
-  MDLocation(LLVMContext &C, StorageType Storage, unsigned Line,
+  DILocation(LLVMContext &C, StorageType Storage, unsigned Line,
              unsigned Column, ArrayRef<Metadata *> MDs);
-  ~MDLocation() { dropAllReferences(); }
+  ~DILocation() { dropAllReferences(); }
 
-  static MDLocation *getImpl(LLVMContext &Context, unsigned Line,
+  static DILocation *getImpl(LLVMContext &Context, unsigned Line,
                              unsigned Column, Metadata *Scope,
                              Metadata *InlinedAt, StorageType Storage,
                              bool ShouldCreate = true);
-  static MDLocation *getImpl(LLVMContext &Context, unsigned Line,
-                             unsigned Column, MDLocalScope *Scope,
-                             MDLocation *InlinedAt, StorageType Storage,
+  static DILocation *getImpl(LLVMContext &Context, unsigned Line,
+                             unsigned Column, DILocalScope *Scope,
+                             DILocation *InlinedAt, StorageType Storage,
                              bool ShouldCreate = true) {
     return getImpl(Context, Line, Column, static_cast<Metadata *>(Scope),
                    static_cast<Metadata *>(InlinedAt), Storage, ShouldCreate);
   }
 
-  TempMDLocation cloneImpl() const {
+  TempDILocation cloneImpl() const {
     return getTemporary(getContext(), getLine(), getColumn(), getScope(),
                         getInlinedAt());
   }
@@ -1157,28 +1151,26 @@
   void replaceOperandWith(unsigned I, Metadata *New) = delete;
 
 public:
-  DEFINE_MDNODE_GET(MDLocation,
+  DEFINE_MDNODE_GET(DILocation,
                     (unsigned Line, unsigned Column, Metadata *Scope,
                      Metadata *InlinedAt = nullptr),
                     (Line, Column, Scope, InlinedAt))
-  DEFINE_MDNODE_GET(MDLocation,
-                    (unsigned Line, unsigned Column, MDLocalScope *Scope,
-                     MDLocation *InlinedAt = nullptr),
+  DEFINE_MDNODE_GET(DILocation,
+                    (unsigned Line, unsigned Column, DILocalScope *Scope,
+                     DILocation *InlinedAt = nullptr),
                     (Line, Column, Scope, InlinedAt))
 
   /// \brief Return a (temporary) clone of this.
-  TempMDLocation clone() const { return cloneImpl(); }
+  TempDILocation clone() const { return cloneImpl(); }
 
   unsigned getLine() const { return SubclassData32; }
   unsigned getColumn() const { return SubclassData16; }
-  MDLocalScope *getScope() const {
-    return cast<MDLocalScope>(getRawScope());
-  }
-  MDLocation *getInlinedAt() const {
-    return cast_or_null<MDLocation>(getRawInlinedAt());
+  DILocalScope *getScope() const { return cast<DILocalScope>(getRawScope()); }
+  DILocation *getInlinedAt() const {
+    return cast_or_null<DILocation>(getRawInlinedAt());
   }
 
-  MDFile *getFile() const { return getScope()->getFile(); }
+  DIFile *getFile() const { return getScope()->getFile(); }
   StringRef getFilename() const { return getScope()->getFilename(); }
   StringRef getDirectory() const { return getScope()->getDirectory(); }
 
@@ -1186,7 +1178,7 @@
   ///
   /// Walk through \a getInlinedAt() and return \a getScope() from the deepest
   /// location.
-  MDLocalScope *getInlinedAtScope() const {
+  DILocalScope *getInlinedAtScope() const {
     if (auto *IA = getInlinedAt())
       return IA->getInlinedAtScope();
     return getScope();
@@ -1205,7 +1197,7 @@
   /// FIXME: Add a check for getColumn().
   /// FIXME: Change the getFilename() check to getFile() (or add one for
   /// getDirectory()).
-  bool canDiscriminate(const MDLocation &RHS) const {
+  bool canDiscriminate(const DILocation &RHS) const {
     return getFilename() != RHS.getFilename() || getLine() != RHS.getLine();
   }
 
@@ -1232,7 +1224,7 @@
   }
 
   static bool classof(const Metadata *MD) {
-    return MD->getMetadataID() == MDLocationKind;
+    return MD->getMetadataID() == DILocationKind;
   }
 };
 
@@ -1240,7 +1232,7 @@
 ///
 /// TODO: Remove DisplayName.  It's always equal to Name.
 /// TODO: Split up flags.
-class MDSubprogram : public MDLocalScope {
+class DISubprogram : public DILocalScope {
   friend class LLVMContextImpl;
   friend class MDNode;
 
@@ -1253,25 +1245,25 @@
   bool IsDefinition;
   bool IsOptimized;
 
-  MDSubprogram(LLVMContext &C, StorageType Storage, unsigned Line,
+  DISubprogram(LLVMContext &C, StorageType Storage, unsigned Line,
                unsigned ScopeLine, unsigned Virtuality, unsigned VirtualIndex,
                unsigned Flags, bool IsLocalToUnit, bool IsDefinition,
                bool IsOptimized, ArrayRef<Metadata *> Ops)
-      : MDLocalScope(C, MDSubprogramKind, Storage, dwarf::DW_TAG_subprogram,
+      : DILocalScope(C, DISubprogramKind, Storage, dwarf::DW_TAG_subprogram,
                      Ops),
         Line(Line), ScopeLine(ScopeLine), Virtuality(Virtuality),
         VirtualIndex(VirtualIndex), Flags(Flags), IsLocalToUnit(IsLocalToUnit),
         IsDefinition(IsDefinition), IsOptimized(IsOptimized) {}
-  ~MDSubprogram() = default;
+  ~DISubprogram() = default;
 
-  static MDSubprogram *
-  getImpl(LLVMContext &Context, MDScopeRef Scope, StringRef Name,
-          StringRef LinkageName, MDFile *File, unsigned Line,
-          MDSubroutineType *Type, bool IsLocalToUnit, bool IsDefinition,
-          unsigned ScopeLine, MDTypeRef ContainingType, unsigned Virtuality,
+  static DISubprogram *
+  getImpl(LLVMContext &Context, DIScopeRef Scope, StringRef Name,
+          StringRef LinkageName, DIFile *File, unsigned Line,
+          DISubroutineType *Type, bool IsLocalToUnit, bool IsDefinition,
+          unsigned ScopeLine, DITypeRef ContainingType, unsigned Virtuality,
           unsigned VirtualIndex, unsigned Flags, bool IsOptimized,
-          Constant *Function, MDTemplateParameterArray TemplateParams,
-          MDSubprogram *Declaration, MDLocalVariableArray Variables,
+          Constant *Function, DITemplateParameterArray TemplateParams,
+          DISubprogram *Declaration, DILocalVariableArray Variables,
           StorageType Storage, bool ShouldCreate = true) {
     return getImpl(Context, Scope, getCanonicalMDString(Context, Name),
                    getCanonicalMDString(Context, LinkageName), File, Line, Type,
@@ -1281,7 +1273,7 @@
                    TemplateParams.get(), Declaration, Variables.get(), Storage,
                    ShouldCreate);
   }
-  static MDSubprogram *
+  static DISubprogram *
   getImpl(LLVMContext &Context, Metadata *Scope, MDString *Name,
           MDString *LinkageName, Metadata *File, unsigned Line, Metadata *Type,
           bool IsLocalToUnit, bool IsDefinition, unsigned ScopeLine,
@@ -1290,7 +1282,7 @@
           Metadata *TemplateParams, Metadata *Declaration, Metadata *Variables,
           StorageType Storage, bool ShouldCreate = true);
 
-  TempMDSubprogram cloneImpl() const {
+  TempDISubprogram cloneImpl() const {
     return getTemporary(getContext(), getScope(), getName(), getLinkageName(),
                         getFile(), getLine(), getType(), isLocalToUnit(),
                         isDefinition(), getScopeLine(), getContainingType(),
@@ -1300,22 +1292,22 @@
   }
 
 public:
-  DEFINE_MDNODE_GET(MDSubprogram,
-                    (MDScopeRef Scope, StringRef Name, StringRef LinkageName,
-                     MDFile *File, unsigned Line, MDSubroutineType *Type,
+  DEFINE_MDNODE_GET(DISubprogram,
+                    (DIScopeRef Scope, StringRef Name, StringRef LinkageName,
+                     DIFile *File, unsigned Line, DISubroutineType *Type,
                      bool IsLocalToUnit, bool IsDefinition, unsigned ScopeLine,
-                     MDTypeRef ContainingType, unsigned Virtuality,
+                     DITypeRef ContainingType, unsigned Virtuality,
                      unsigned VirtualIndex, unsigned Flags, bool IsOptimized,
                      Constant *Function = nullptr,
-                     MDTemplateParameterArray TemplateParams = nullptr,
-                     MDSubprogram *Declaration = nullptr,
-                     MDLocalVariableArray Variables = nullptr),
+                     DITemplateParameterArray TemplateParams = nullptr,
+                     DISubprogram *Declaration = nullptr,
+                     DILocalVariableArray Variables = nullptr),
                     (Scope, Name, LinkageName, File, Line, Type, IsLocalToUnit,
                      IsDefinition, ScopeLine, ContainingType, Virtuality,
                      VirtualIndex, Flags, IsOptimized, Function, TemplateParams,
                      Declaration, Variables))
   DEFINE_MDNODE_GET(
-      MDSubprogram,
+      DISubprogram,
       (Metadata * Scope, MDString *Name, MDString *LinkageName, Metadata *File,
        unsigned Line, Metadata *Type, bool IsLocalToUnit, bool IsDefinition,
        unsigned ScopeLine, Metadata *ContainingType, unsigned Virtuality,
@@ -1326,7 +1318,7 @@
        ScopeLine, ContainingType, Virtuality, VirtualIndex, Flags, IsOptimized,
        Function, TemplateParams, Declaration, Variables))
 
-  TempMDSubprogram clone() const { return cloneImpl(); }
+  TempDISubprogram clone() const { return cloneImpl(); }
 
 public:
   unsigned getLine() const { return Line; }
@@ -1367,7 +1359,7 @@
     return getFlags() & FlagRValueReference;
   }
 
-  MDScopeRef getScope() const { return MDScopeRef(getRawScope()); }
+  DIScopeRef getScope() const { return DIScopeRef(getRawScope()); }
 
   StringRef getName() const { return getStringOperand(2); }
   StringRef getDisplayName() const { return getStringOperand(3); }
@@ -1376,11 +1368,11 @@
   MDString *getRawName() const { return getOperandAs<MDString>(2); }
   MDString *getRawLinkageName() const { return getOperandAs<MDString>(4); }
 
-  MDSubroutineType *getType() const {
-    return cast_or_null<MDSubroutineType>(getRawType());
+  DISubroutineType *getType() const {
+    return cast_or_null<DISubroutineType>(getRawType());
   }
-  MDTypeRef getContainingType() const {
-    return MDTypeRef(getRawContainingType());
+  DITypeRef getContainingType() const {
+    return DITypeRef(getRawContainingType());
   }
 
   Constant *getFunctionConstant() const {
@@ -1388,13 +1380,13 @@
       return C->getValue();
     return nullptr;
   }
-  MDTemplateParameterArray getTemplateParams() const {
+  DITemplateParameterArray getTemplateParams() const {
     return cast_or_null<MDTuple>(getRawTemplateParams());
   }
-  MDSubprogram *getDeclaration() const {
-    return cast_or_null<MDSubprogram>(getRawDeclaration());
+  DISubprogram *getDeclaration() const {
+    return cast_or_null<DISubprogram>(getRawDeclaration());
   }
-  MDLocalVariableArray getVariables() const {
+  DILocalVariableArray getVariables() const {
     return cast_or_null<MDTuple>(getRawVariables());
   }
 
@@ -1430,50 +1422,50 @@
   bool describes(const Function *F) const;
 
   static bool classof(const Metadata *MD) {
-    return MD->getMetadataID() == MDSubprogramKind;
+    return MD->getMetadataID() == DISubprogramKind;
   }
 };
 
-class MDLexicalBlockBase : public MDLocalScope {
+class DILexicalBlockBase : public DILocalScope {
 protected:
-  MDLexicalBlockBase(LLVMContext &C, unsigned ID, StorageType Storage,
+  DILexicalBlockBase(LLVMContext &C, unsigned ID, StorageType Storage,
                      ArrayRef<Metadata *> Ops)
-      : MDLocalScope(C, ID, Storage, dwarf::DW_TAG_lexical_block, Ops) {}
-  ~MDLexicalBlockBase() = default;
+      : DILocalScope(C, ID, Storage, dwarf::DW_TAG_lexical_block, Ops) {}
+  ~DILexicalBlockBase() = default;
 
 public:
-  MDLocalScope *getScope() const { return cast<MDLocalScope>(getRawScope()); }
+  DILocalScope *getScope() const { return cast<DILocalScope>(getRawScope()); }
 
   Metadata *getRawScope() const { return getOperand(1); }
 
   /// \brief Forwarding accessors to LexicalBlock.
   ///
-  /// TODO: Remove these and update code to use \a MDLexicalBlock directly.
+  /// TODO: Remove these and update code to use \a DILexicalBlock directly.
   /// @{
   inline unsigned getLine() const;
   inline unsigned getColumn() const;
   /// @}
   static bool classof(const Metadata *MD) {
-    return MD->getMetadataID() == MDLexicalBlockKind ||
-           MD->getMetadataID() == MDLexicalBlockFileKind;
+    return MD->getMetadataID() == DILexicalBlockKind ||
+           MD->getMetadataID() == DILexicalBlockFileKind;
   }
 };
 
-class MDLexicalBlock : public MDLexicalBlockBase {
+class DILexicalBlock : public DILexicalBlockBase {
   friend class LLVMContextImpl;
   friend class MDNode;
 
   unsigned Line;
   unsigned Column;
 
-  MDLexicalBlock(LLVMContext &C, StorageType Storage, unsigned Line,
+  DILexicalBlock(LLVMContext &C, StorageType Storage, unsigned Line,
                  unsigned Column, ArrayRef<Metadata *> Ops)
-      : MDLexicalBlockBase(C, MDLexicalBlockKind, Storage, Ops), Line(Line),
+      : DILexicalBlockBase(C, DILexicalBlockKind, Storage, Ops), Line(Line),
         Column(Column) {}
-  ~MDLexicalBlock() = default;
+  ~DILexicalBlock() = default;
 
-  static MDLexicalBlock *getImpl(LLVMContext &Context, MDLocalScope *Scope,
-                                 MDFile *File, unsigned Line, unsigned Column,
+  static DILexicalBlock *getImpl(LLVMContext &Context, DILocalScope *Scope,
+                                 DIFile *File, unsigned Line, unsigned Column,
                                  StorageType Storage,
                                  bool ShouldCreate = true) {
     return getImpl(Context, static_cast<Metadata *>(Scope),
@@ -1481,59 +1473,59 @@
                    ShouldCreate);
   }
 
-  static MDLexicalBlock *getImpl(LLVMContext &Context, Metadata *Scope,
+  static DILexicalBlock *getImpl(LLVMContext &Context, Metadata *Scope,
                                  Metadata *File, unsigned Line, unsigned Column,
                                  StorageType Storage, bool ShouldCreate = true);
 
-  TempMDLexicalBlock cloneImpl() const {
+  TempDILexicalBlock cloneImpl() const {
     return getTemporary(getContext(), getScope(), getFile(), getLine(),
                         getColumn());
   }
 
 public:
-  DEFINE_MDNODE_GET(MDLexicalBlock, (MDLocalScope * Scope, MDFile *File,
+  DEFINE_MDNODE_GET(DILexicalBlock, (DILocalScope * Scope, DIFile *File,
                                      unsigned Line, unsigned Column),
                     (Scope, File, Line, Column))
-  DEFINE_MDNODE_GET(MDLexicalBlock, (Metadata * Scope, Metadata *File,
+  DEFINE_MDNODE_GET(DILexicalBlock, (Metadata * Scope, Metadata *File,
                                      unsigned Line, unsigned Column),
                     (Scope, File, Line, Column))
 
-  TempMDLexicalBlock clone() const { return cloneImpl(); }
+  TempDILexicalBlock clone() const { return cloneImpl(); }
 
   unsigned getLine() const { return Line; }
   unsigned getColumn() const { return Column; }
 
   static bool classof(const Metadata *MD) {
-    return MD->getMetadataID() == MDLexicalBlockKind;
+    return MD->getMetadataID() == DILexicalBlockKind;
   }
 };
 
-unsigned MDLexicalBlockBase::getLine() const {
-  if (auto *N = dyn_cast<MDLexicalBlock>(this))
+unsigned DILexicalBlockBase::getLine() const {
+  if (auto *N = dyn_cast<DILexicalBlock>(this))
     return N->getLine();
   return 0;
 }
 
-unsigned MDLexicalBlockBase::getColumn() const {
-  if (auto *N = dyn_cast<MDLexicalBlock>(this))
+unsigned DILexicalBlockBase::getColumn() const {
+  if (auto *N = dyn_cast<DILexicalBlock>(this))
     return N->getColumn();
   return 0;
 }
 
-class MDLexicalBlockFile : public MDLexicalBlockBase {
+class DILexicalBlockFile : public DILexicalBlockBase {
   friend class LLVMContextImpl;
   friend class MDNode;
 
   unsigned Discriminator;
 
-  MDLexicalBlockFile(LLVMContext &C, StorageType Storage,
+  DILexicalBlockFile(LLVMContext &C, StorageType Storage,
                      unsigned Discriminator, ArrayRef<Metadata *> Ops)
-      : MDLexicalBlockBase(C, MDLexicalBlockFileKind, Storage, Ops),
+      : DILexicalBlockBase(C, DILexicalBlockFileKind, Storage, Ops),
         Discriminator(Discriminator) {}
-  ~MDLexicalBlockFile() = default;
+  ~DILexicalBlockFile() = default;
 
-  static MDLexicalBlockFile *getImpl(LLVMContext &Context, MDLocalScope *Scope,
-                                     MDFile *File, unsigned Discriminator,
+  static DILexicalBlockFile *getImpl(LLVMContext &Context, DILocalScope *Scope,
+                                     DIFile *File, unsigned Discriminator,
                                      StorageType Storage,
                                      bool ShouldCreate = true) {
     return getImpl(Context, static_cast<Metadata *>(Scope),
@@ -1541,213 +1533,213 @@
                    ShouldCreate);
   }
 
-  static MDLexicalBlockFile *getImpl(LLVMContext &Context, Metadata *Scope,
+  static DILexicalBlockFile *getImpl(LLVMContext &Context, Metadata *Scope,
                                      Metadata *File, unsigned Discriminator,
                                      StorageType Storage,
                                      bool ShouldCreate = true);
 
-  TempMDLexicalBlockFile cloneImpl() const {
+  TempDILexicalBlockFile cloneImpl() const {
     return getTemporary(getContext(), getScope(), getFile(),
                         getDiscriminator());
   }
 
 public:
-  DEFINE_MDNODE_GET(MDLexicalBlockFile, (MDLocalScope * Scope, MDFile *File,
+  DEFINE_MDNODE_GET(DILexicalBlockFile, (DILocalScope * Scope, DIFile *File,
                                          unsigned Discriminator),
                     (Scope, File, Discriminator))
-  DEFINE_MDNODE_GET(MDLexicalBlockFile,
+  DEFINE_MDNODE_GET(DILexicalBlockFile,
                     (Metadata * Scope, Metadata *File, unsigned Discriminator),
                     (Scope, File, Discriminator))
 
-  TempMDLexicalBlockFile clone() const { return cloneImpl(); }
+  TempDILexicalBlockFile clone() const { return cloneImpl(); }
 
-  // TODO: Remove these once they're gone from MDLexicalBlockBase.
+  // TODO: Remove these once they're gone from DILexicalBlockBase.
   unsigned getLine() const = delete;
   unsigned getColumn() const = delete;
 
   unsigned getDiscriminator() const { return Discriminator; }
 
   static bool classof(const Metadata *MD) {
-    return MD->getMetadataID() == MDLexicalBlockFileKind;
+    return MD->getMetadataID() == DILexicalBlockFileKind;
   }
 };
 
-unsigned MDLocation::getDiscriminator() const {
-  if (auto *F = dyn_cast<MDLexicalBlockFile>(getScope()))
+unsigned DILocation::getDiscriminator() const {
+  if (auto *F = dyn_cast<DILexicalBlockFile>(getScope()))
     return F->getDiscriminator();
   return 0;
 }
 
-class MDNamespace : public MDScope {
+class DINamespace : public DIScope {
   friend class LLVMContextImpl;
   friend class MDNode;
 
   unsigned Line;
 
-  MDNamespace(LLVMContext &Context, StorageType Storage, unsigned Line,
+  DINamespace(LLVMContext &Context, StorageType Storage, unsigned Line,
               ArrayRef<Metadata *> Ops)
-      : MDScope(Context, MDNamespaceKind, Storage, dwarf::DW_TAG_namespace,
+      : DIScope(Context, DINamespaceKind, Storage, dwarf::DW_TAG_namespace,
                 Ops),
         Line(Line) {}
-  ~MDNamespace() = default;
+  ~DINamespace() = default;
 
-  static MDNamespace *getImpl(LLVMContext &Context, MDScope *Scope,
-                              MDFile *File, StringRef Name, unsigned Line,
+  static DINamespace *getImpl(LLVMContext &Context, DIScope *Scope,
+                              DIFile *File, StringRef Name, unsigned Line,
                               StorageType Storage, bool ShouldCreate = true) {
     return getImpl(Context, Scope, File, getCanonicalMDString(Context, Name),
                    Line, Storage, ShouldCreate);
   }
-  static MDNamespace *getImpl(LLVMContext &Context, Metadata *Scope,
+  static DINamespace *getImpl(LLVMContext &Context, Metadata *Scope,
                               Metadata *File, MDString *Name, unsigned Line,
                               StorageType Storage, bool ShouldCreate = true);
 
-  TempMDNamespace cloneImpl() const {
+  TempDINamespace cloneImpl() const {
     return getTemporary(getContext(), getScope(), getFile(), getName(),
                         getLine());
   }
 
 public:
-  DEFINE_MDNODE_GET(MDNamespace, (MDScope * Scope, MDFile *File, StringRef Name,
+  DEFINE_MDNODE_GET(DINamespace, (DIScope * Scope, DIFile *File, StringRef Name,
                                   unsigned Line),
                     (Scope, File, Name, Line))
-  DEFINE_MDNODE_GET(MDNamespace, (Metadata * Scope, Metadata *File,
+  DEFINE_MDNODE_GET(DINamespace, (Metadata * Scope, Metadata *File,
                                   MDString *Name, unsigned Line),
                     (Scope, File, Name, Line))
 
-  TempMDNamespace clone() const { return cloneImpl(); }
+  TempDINamespace clone() const { return cloneImpl(); }
 
   unsigned getLine() const { return Line; }
-  MDScope *getScope() const { return cast_or_null<MDScope>(getRawScope()); }
+  DIScope *getScope() const { return cast_or_null<DIScope>(getRawScope()); }
   StringRef getName() const { return getStringOperand(2); }
 
   Metadata *getRawScope() const { return getOperand(1); }
   MDString *getRawName() const { return getOperandAs<MDString>(2); }
 
   static bool classof(const Metadata *MD) {
-    return MD->getMetadataID() == MDNamespaceKind;
+    return MD->getMetadataID() == DINamespaceKind;
   }
 };
 
 /// \brief Base class for template parameters.
-class MDTemplateParameter : public DebugNode {
+class DITemplateParameter : public DINode {
 protected:
-  MDTemplateParameter(LLVMContext &Context, unsigned ID, StorageType Storage,
+  DITemplateParameter(LLVMContext &Context, unsigned ID, StorageType Storage,
                       unsigned Tag, ArrayRef<Metadata *> Ops)
-      : DebugNode(Context, ID, Storage, Tag, Ops) {}
-  ~MDTemplateParameter() = default;
+      : DINode(Context, ID, Storage, Tag, Ops) {}
+  ~DITemplateParameter() = default;
 
 public:
   StringRef getName() const { return getStringOperand(0); }
-  MDTypeRef getType() const { return MDTypeRef(getRawType()); }
+  DITypeRef getType() const { return DITypeRef(getRawType()); }
 
   MDString *getRawName() const { return getOperandAs<MDString>(0); }
   Metadata *getRawType() const { return getOperand(1); }
 
   static bool classof(const Metadata *MD) {
-    return MD->getMetadataID() == MDTemplateTypeParameterKind ||
-           MD->getMetadataID() == MDTemplateValueParameterKind;
+    return MD->getMetadataID() == DITemplateTypeParameterKind ||
+           MD->getMetadataID() == DITemplateValueParameterKind;
   }
 };
 
-class MDTemplateTypeParameter : public MDTemplateParameter {
+class DITemplateTypeParameter : public DITemplateParameter {
   friend class LLVMContextImpl;
   friend class MDNode;
 
-  MDTemplateTypeParameter(LLVMContext &Context, StorageType Storage,
+  DITemplateTypeParameter(LLVMContext &Context, StorageType Storage,
                           ArrayRef<Metadata *> Ops)
-      : MDTemplateParameter(Context, MDTemplateTypeParameterKind, Storage,
+      : DITemplateParameter(Context, DITemplateTypeParameterKind, Storage,
                             dwarf::DW_TAG_template_type_parameter, Ops) {}
-  ~MDTemplateTypeParameter() = default;
+  ~DITemplateTypeParameter() = default;
 
-  static MDTemplateTypeParameter *getImpl(LLVMContext &Context, StringRef Name,
-                                          MDTypeRef Type, StorageType Storage,
+  static DITemplateTypeParameter *getImpl(LLVMContext &Context, StringRef Name,
+                                          DITypeRef Type, StorageType Storage,
                                           bool ShouldCreate = true) {
     return getImpl(Context, getCanonicalMDString(Context, Name), Type, Storage,
                    ShouldCreate);
   }
-  static MDTemplateTypeParameter *getImpl(LLVMContext &Context, MDString *Name,
+  static DITemplateTypeParameter *getImpl(LLVMContext &Context, MDString *Name,
                                           Metadata *Type, StorageType Storage,
                                           bool ShouldCreate = true);
 
-  TempMDTemplateTypeParameter cloneImpl() const {
+  TempDITemplateTypeParameter cloneImpl() const {
     return getTemporary(getContext(), getName(), getType());
   }
 
 public:
-  DEFINE_MDNODE_GET(MDTemplateTypeParameter, (StringRef Name, MDTypeRef Type),
+  DEFINE_MDNODE_GET(DITemplateTypeParameter, (StringRef Name, DITypeRef Type),
                     (Name, Type))
-  DEFINE_MDNODE_GET(MDTemplateTypeParameter, (MDString * Name, Metadata *Type),
+  DEFINE_MDNODE_GET(DITemplateTypeParameter, (MDString * Name, Metadata *Type),
                     (Name, Type))
 
-  TempMDTemplateTypeParameter clone() const { return cloneImpl(); }
+  TempDITemplateTypeParameter clone() const { return cloneImpl(); }
 
   static bool classof(const Metadata *MD) {
-    return MD->getMetadataID() == MDTemplateTypeParameterKind;
+    return MD->getMetadataID() == DITemplateTypeParameterKind;
   }
 };
 
-class MDTemplateValueParameter : public MDTemplateParameter {
+class DITemplateValueParameter : public DITemplateParameter {
   friend class LLVMContextImpl;
   friend class MDNode;
 
-  MDTemplateValueParameter(LLVMContext &Context, StorageType Storage,
+  DITemplateValueParameter(LLVMContext &Context, StorageType Storage,
                            unsigned Tag, ArrayRef<Metadata *> Ops)
-      : MDTemplateParameter(Context, MDTemplateValueParameterKind, Storage, Tag,
+      : DITemplateParameter(Context, DITemplateValueParameterKind, Storage, Tag,
                             Ops) {}
-  ~MDTemplateValueParameter() = default;
+  ~DITemplateValueParameter() = default;
 
-  static MDTemplateValueParameter *getImpl(LLVMContext &Context, unsigned Tag,
-                                           StringRef Name, MDTypeRef Type,
+  static DITemplateValueParameter *getImpl(LLVMContext &Context, unsigned Tag,
+                                           StringRef Name, DITypeRef Type,
                                            Metadata *Value, StorageType Storage,
                                            bool ShouldCreate = true) {
     return getImpl(Context, Tag, getCanonicalMDString(Context, Name), Type,
                    Value, Storage, ShouldCreate);
   }
-  static MDTemplateValueParameter *getImpl(LLVMContext &Context, unsigned Tag,
+  static DITemplateValueParameter *getImpl(LLVMContext &Context, unsigned Tag,
                                            MDString *Name, Metadata *Type,
                                            Metadata *Value, StorageType Storage,
                                            bool ShouldCreate = true);
 
-  TempMDTemplateValueParameter cloneImpl() const {
+  TempDITemplateValueParameter cloneImpl() const {
     return getTemporary(getContext(), getTag(), getName(), getType(),
                         getValue());
   }
 
 public:
-  DEFINE_MDNODE_GET(MDTemplateValueParameter, (unsigned Tag, StringRef Name,
-                                               MDTypeRef Type, Metadata *Value),
+  DEFINE_MDNODE_GET(DITemplateValueParameter, (unsigned Tag, StringRef Name,
+                                               DITypeRef Type, Metadata *Value),
                     (Tag, Name, Type, Value))
-  DEFINE_MDNODE_GET(MDTemplateValueParameter, (unsigned Tag, MDString *Name,
+  DEFINE_MDNODE_GET(DITemplateValueParameter, (unsigned Tag, MDString *Name,
                                                Metadata *Type, Metadata *Value),
                     (Tag, Name, Type, Value))
 
-  TempMDTemplateValueParameter clone() const { return cloneImpl(); }
+  TempDITemplateValueParameter clone() const { return cloneImpl(); }
 
   Metadata *getValue() const { return getOperand(2); }
 
   static bool classof(const Metadata *MD) {
-    return MD->getMetadataID() == MDTemplateValueParameterKind;
+    return MD->getMetadataID() == DITemplateValueParameterKind;
   }
 };
 
 /// \brief Base class for variables.
 ///
 /// TODO: Hardcode to DW_TAG_variable.
-class MDVariable : public DebugNode {
+class DIVariable : public DINode {
   unsigned Line;
 
 protected:
-  MDVariable(LLVMContext &C, unsigned ID, StorageType Storage, unsigned Tag,
+  DIVariable(LLVMContext &C, unsigned ID, StorageType Storage, unsigned Tag,
              unsigned Line, ArrayRef<Metadata *> Ops)
-      : DebugNode(C, ID, Storage, Tag, Ops), Line(Line) {}
-  ~MDVariable() = default;
+      : DINode(C, ID, Storage, Tag, Ops), Line(Line) {}
+  ~DIVariable() = default;
 
 public:
   unsigned getLine() const { return Line; }
-  MDScope *getScope() const { return cast_or_null<MDScope>(getRawScope()); }
+  DIScope *getScope() const { return cast_or_null<DIScope>(getRawScope()); }
   StringRef getName() const { return getStringOperand(1); }
-  MDFile *getFile() const { return cast_or_null<MDFile>(getRawFile()); }
-  MDTypeRef getType() const { return MDTypeRef(getRawType()); }
+  DIFile *getFile() const { return cast_or_null<DIFile>(getRawFile()); }
+  DITypeRef getType() const { return DITypeRef(getRawType()); }
 
   StringRef getFilename() const {
     if (auto *F = getFile())
@@ -1766,34 +1758,34 @@
   Metadata *getRawType() const { return getOperand(3); }
 
   static bool classof(const Metadata *MD) {
-    return MD->getMetadataID() == MDLocalVariableKind ||
-           MD->getMetadataID() == MDGlobalVariableKind;
+    return MD->getMetadataID() == DILocalVariableKind ||
+           MD->getMetadataID() == DIGlobalVariableKind;
   }
 };
 
 /// \brief Global variables.
 ///
 /// TODO: Remove DisplayName.  It's always equal to Name.
-class MDGlobalVariable : public MDVariable {
+class DIGlobalVariable : public DIVariable {
   friend class LLVMContextImpl;
   friend class MDNode;
 
   bool IsLocalToUnit;
   bool IsDefinition;
 
-  MDGlobalVariable(LLVMContext &C, StorageType Storage, unsigned Line,
+  DIGlobalVariable(LLVMContext &C, StorageType Storage, unsigned Line,
                    bool IsLocalToUnit, bool IsDefinition,
                    ArrayRef<Metadata *> Ops)
-      : MDVariable(C, MDGlobalVariableKind, Storage, dwarf::DW_TAG_variable,
+      : DIVariable(C, DIGlobalVariableKind, Storage, dwarf::DW_TAG_variable,
                    Line, Ops),
         IsLocalToUnit(IsLocalToUnit), IsDefinition(IsDefinition) {}
-  ~MDGlobalVariable() = default;
+  ~DIGlobalVariable() = default;
 
-  static MDGlobalVariable *
-  getImpl(LLVMContext &Context, MDScope *Scope, StringRef Name,
-          StringRef LinkageName, MDFile *File, unsigned Line, MDTypeRef Type,
+  static DIGlobalVariable *
+  getImpl(LLVMContext &Context, DIScope *Scope, StringRef Name,
+          StringRef LinkageName, DIFile *File, unsigned Line, DITypeRef Type,
           bool IsLocalToUnit, bool IsDefinition, Constant *Variable,
-          MDDerivedType *StaticDataMemberDeclaration, StorageType Storage,
+          DIDerivedType *StaticDataMemberDeclaration, StorageType Storage,
           bool ShouldCreate = true) {
     return getImpl(Context, Scope, getCanonicalMDString(Context, Name),
                    getCanonicalMDString(Context, LinkageName), File, Line, Type,
@@ -1801,14 +1793,14 @@
                    Variable ? ConstantAsMetadata::get(Variable) : nullptr,
                    StaticDataMemberDeclaration, Storage, ShouldCreate);
   }
-  static MDGlobalVariable *
+  static DIGlobalVariable *
   getImpl(LLVMContext &Context, Metadata *Scope, MDString *Name,
           MDString *LinkageName, Metadata *File, unsigned Line, Metadata *Type,
           bool IsLocalToUnit, bool IsDefinition, Metadata *Variable,
           Metadata *StaticDataMemberDeclaration, StorageType Storage,
           bool ShouldCreate = true);
 
-  TempMDGlobalVariable cloneImpl() const {
+  TempDIGlobalVariable cloneImpl() const {
     return getTemporary(getContext(), getScope(), getName(), getLinkageName(),
                         getFile(), getLine(), getType(), isLocalToUnit(),
                         isDefinition(), getVariable(),
@@ -1816,14 +1808,14 @@
   }
 
 public:
-  DEFINE_MDNODE_GET(MDGlobalVariable,
-                    (MDScope * Scope, StringRef Name, StringRef LinkageName,
-                     MDFile *File, unsigned Line, MDTypeRef Type,
+  DEFINE_MDNODE_GET(DIGlobalVariable,
+                    (DIScope * Scope, StringRef Name, StringRef LinkageName,
+                     DIFile *File, unsigned Line, DITypeRef Type,
                      bool IsLocalToUnit, bool IsDefinition, Constant *Variable,
-                     MDDerivedType *StaticDataMemberDeclaration),
+                     DIDerivedType *StaticDataMemberDeclaration),
                     (Scope, Name, LinkageName, File, Line, Type, IsLocalToUnit,
                      IsDefinition, Variable, StaticDataMemberDeclaration))
-  DEFINE_MDNODE_GET(MDGlobalVariable,
+  DEFINE_MDNODE_GET(DIGlobalVariable,
                     (Metadata * Scope, MDString *Name, MDString *LinkageName,
                      Metadata *File, unsigned Line, Metadata *Type,
                      bool IsLocalToUnit, bool IsDefinition, Metadata *Variable,
@@ -1831,7 +1823,7 @@
                     (Scope, Name, LinkageName, File, Line, Type, IsLocalToUnit,
                      IsDefinition, Variable, StaticDataMemberDeclaration))
 
-  TempMDGlobalVariable clone() const { return cloneImpl(); }
+  TempDIGlobalVariable clone() const { return cloneImpl(); }
 
   bool isLocalToUnit() const { return IsLocalToUnit; }
   bool isDefinition() const { return IsDefinition; }
@@ -1842,8 +1834,8 @@
       return dyn_cast<Constant>(C->getValue());
     return nullptr;
   }
-  MDDerivedType *getStaticDataMemberDeclaration() const {
-    return cast_or_null<MDDerivedType>(getRawStaticDataMemberDeclaration());
+  DIDerivedType *getStaticDataMemberDeclaration() const {
+    return cast_or_null<DIDerivedType>(getRawStaticDataMemberDeclaration());
   }
 
   MDString *getRawLinkageName() const { return getOperandAs<MDString>(5); }
@@ -1851,7 +1843,7 @@
   Metadata *getRawStaticDataMemberDeclaration() const { return getOperand(7); }
 
   static bool classof(const Metadata *MD) {
-    return MD->getMetadataID() == MDGlobalVariableKind;
+    return MD->getMetadataID() == DIGlobalVariableKind;
   }
 };
 
@@ -1860,57 +1852,57 @@
 /// TODO: Split between arguments and otherwise.
 /// TODO: Use \c DW_TAG_variable instead of fake tags.
 /// TODO: Split up flags.
-class MDLocalVariable : public MDVariable {
+class DILocalVariable : public DIVariable {
   friend class LLVMContextImpl;
   friend class MDNode;
 
   unsigned Arg;
   unsigned Flags;
 
-  MDLocalVariable(LLVMContext &C, StorageType Storage, unsigned Tag,
+  DILocalVariable(LLVMContext &C, StorageType Storage, unsigned Tag,
                   unsigned Line, unsigned Arg, unsigned Flags,
                   ArrayRef<Metadata *> Ops)
-      : MDVariable(C, MDLocalVariableKind, Storage, Tag, Line, Ops), Arg(Arg),
+      : DIVariable(C, DILocalVariableKind, Storage, Tag, Line, Ops), Arg(Arg),
         Flags(Flags) {}
-  ~MDLocalVariable() = default;
+  ~DILocalVariable() = default;
 
-  static MDLocalVariable *getImpl(LLVMContext &Context, unsigned Tag,
-                                  MDScope *Scope, StringRef Name, MDFile *File,
-                                  unsigned Line, MDTypeRef Type, unsigned Arg,
+  static DILocalVariable *getImpl(LLVMContext &Context, unsigned Tag,
+                                  DIScope *Scope, StringRef Name, DIFile *File,
+                                  unsigned Line, DITypeRef Type, unsigned Arg,
                                   unsigned Flags, StorageType Storage,
                                   bool ShouldCreate = true) {
     return getImpl(Context, Tag, Scope, getCanonicalMDString(Context, Name),
                    File, Line, Type, Arg, Flags, Storage, ShouldCreate);
   }
-  static MDLocalVariable *
+  static DILocalVariable *
   getImpl(LLVMContext &Context, unsigned Tag, Metadata *Scope, MDString *Name,
           Metadata *File, unsigned Line, Metadata *Type, unsigned Arg,
           unsigned Flags, StorageType Storage, bool ShouldCreate = true);
 
-  TempMDLocalVariable cloneImpl() const {
+  TempDILocalVariable cloneImpl() const {
     return getTemporary(getContext(), getTag(), getScope(), getName(),
                         getFile(), getLine(), getType(), getArg(), getFlags());
   }
 
 public:
-  DEFINE_MDNODE_GET(MDLocalVariable,
-                    (unsigned Tag, MDLocalScope *Scope, StringRef Name,
-                     MDFile *File, unsigned Line, MDTypeRef Type, unsigned Arg,
+  DEFINE_MDNODE_GET(DILocalVariable,
+                    (unsigned Tag, DILocalScope *Scope, StringRef Name,
+                     DIFile *File, unsigned Line, DITypeRef Type, unsigned Arg,
                      unsigned Flags),
                     (Tag, Scope, Name, File, Line, Type, Arg, Flags))
-  DEFINE_MDNODE_GET(MDLocalVariable,
+  DEFINE_MDNODE_GET(DILocalVariable,
                     (unsigned Tag, Metadata *Scope, MDString *Name,
                      Metadata *File, unsigned Line, Metadata *Type,
                      unsigned Arg, unsigned Flags),
                     (Tag, Scope, Name, File, Line, Type, Arg, Flags))
 
-  TempMDLocalVariable clone() const { return cloneImpl(); }
+  TempDILocalVariable clone() const { return cloneImpl(); }
 
   /// \brief Get the local scope for this variable.
   ///
   /// Variables must be defined in a local scope.
-  MDLocalScope *getScope() const {
-    return cast<MDLocalScope>(MDVariable::getScope());
+  DILocalScope *getScope() const {
+    return cast<DILocalScope>(DIVariable::getScope());
   }
 
   unsigned getArg() const { return Arg; }
@@ -1924,12 +1916,12 @@
   /// Check that \c DL exists, is in the same subprogram, and has the same
   /// inlined-at location as \c this.  (Otherwise, it's not a valid attachemnt
   /// to a \a DbgInfoIntrinsic.)
-  bool isValidLocationForIntrinsic(const MDLocation *DL) const {
+  bool isValidLocationForIntrinsic(const DILocation *DL) const {
     return DL && getScope()->getSubprogram() == DL->getScope()->getSubprogram();
   }
 
   static bool classof(const Metadata *MD) {
-    return MD->getMetadataID() == MDLocalVariableKind;
+    return MD->getMetadataID() == DILocalVariableKind;
   }
 };
 
@@ -1944,29 +1936,29 @@
 /// TODO: Co-allocate the expression elements.
 /// TODO: Separate from MDNode, or otherwise drop Distinct and Temporary
 /// storage types.
-class MDExpression : public MDNode {
+class DIExpression : public MDNode {
   friend class LLVMContextImpl;
   friend class MDNode;
 
   std::vector<uint64_t> Elements;
 
-  MDExpression(LLVMContext &C, StorageType Storage, ArrayRef<uint64_t> Elements)
-      : MDNode(C, MDExpressionKind, Storage, None),
+  DIExpression(LLVMContext &C, StorageType Storage, ArrayRef<uint64_t> Elements)
+      : MDNode(C, DIExpressionKind, Storage, None),
         Elements(Elements.begin(), Elements.end()) {}
-  ~MDExpression() = default;
+  ~DIExpression() = default;
 
-  static MDExpression *getImpl(LLVMContext &Context,
+  static DIExpression *getImpl(LLVMContext &Context,
                                ArrayRef<uint64_t> Elements, StorageType Storage,
                                bool ShouldCreate = true);
 
-  TempMDExpression cloneImpl() const {
+  TempDIExpression cloneImpl() const {
     return getTemporary(getContext(), getElements());
   }
 
 public:
-  DEFINE_MDNODE_GET(MDExpression, (ArrayRef<uint64_t> Elements), (Elements))
+  DEFINE_MDNODE_GET(DIExpression, (ArrayRef<uint64_t> Elements), (Elements))
 
-  TempMDExpression clone() const { return cloneImpl(); }
+  TempDIExpression clone() const { return cloneImpl(); }
 
   ArrayRef<uint64_t> getElements() const { return Elements; }
 
@@ -1991,7 +1983,7 @@
 
   /// \brief A lightweight wrapper around an expression operand.
   ///
-  /// TODO: Store arguments directly and change \a MDExpression to store a
+  /// TODO: Store arguments directly and change \a DIExpression to store a
   /// range of these.
   class ExprOperand {
     const uint64_t *Op;
@@ -2076,65 +2068,65 @@
   bool isValid() const;
 
   static bool classof(const Metadata *MD) {
-    return MD->getMetadataID() == MDExpressionKind;
+    return MD->getMetadataID() == DIExpressionKind;
   }
 };
 
-class MDObjCProperty : public DebugNode {
+class DIObjCProperty : public DINode {
   friend class LLVMContextImpl;
   friend class MDNode;
 
   unsigned Line;
   unsigned Attributes;
 
-  MDObjCProperty(LLVMContext &C, StorageType Storage, unsigned Line,
+  DIObjCProperty(LLVMContext &C, StorageType Storage, unsigned Line,
                  unsigned Attributes, ArrayRef<Metadata *> Ops)
-      : DebugNode(C, MDObjCPropertyKind, Storage, dwarf::DW_TAG_APPLE_property,
-                  Ops),
+      : DINode(C, DIObjCPropertyKind, Storage, dwarf::DW_TAG_APPLE_property,
+               Ops),
         Line(Line), Attributes(Attributes) {}
-  ~MDObjCProperty() = default;
+  ~DIObjCProperty() = default;
 
-  static MDObjCProperty *
-  getImpl(LLVMContext &Context, StringRef Name, MDFile *File, unsigned Line,
+  static DIObjCProperty *
+  getImpl(LLVMContext &Context, StringRef Name, DIFile *File, unsigned Line,
           StringRef GetterName, StringRef SetterName, unsigned Attributes,
-          MDType *Type, StorageType Storage, bool ShouldCreate = true) {
+          DIType *Type, StorageType Storage, bool ShouldCreate = true) {
     return getImpl(Context, getCanonicalMDString(Context, Name), File, Line,
                    getCanonicalMDString(Context, GetterName),
                    getCanonicalMDString(Context, SetterName), Attributes, Type,
                    Storage, ShouldCreate);
   }
-  static MDObjCProperty *getImpl(LLVMContext &Context, MDString *Name,
+  static DIObjCProperty *getImpl(LLVMContext &Context, MDString *Name,
                                  Metadata *File, unsigned Line,
                                  MDString *GetterName, MDString *SetterName,
                                  unsigned Attributes, Metadata *Type,
                                  StorageType Storage, bool ShouldCreate = true);
 
-  TempMDObjCProperty cloneImpl() const {
+  TempDIObjCProperty cloneImpl() const {
     return getTemporary(getContext(), getName(), getFile(), getLine(),
                         getGetterName(), getSetterName(), getAttributes(),
                         getType());
   }
 
 public:
-  DEFINE_MDNODE_GET(MDObjCProperty,
-                    (StringRef Name, MDFile *File, unsigned Line,
+  DEFINE_MDNODE_GET(DIObjCProperty,
+                    (StringRef Name, DIFile *File, unsigned Line,
                      StringRef GetterName, StringRef SetterName,
-                     unsigned Attributes, MDType *Type),
+                     unsigned Attributes, DIType *Type),
                     (Name, File, Line, GetterName, SetterName, Attributes,
                      Type))
-  DEFINE_MDNODE_GET(MDObjCProperty,
+  DEFINE_MDNODE_GET(DIObjCProperty,
                     (MDString * Name, Metadata *File, unsigned Line,
                      MDString *GetterName, MDString *SetterName,
                      unsigned Attributes, Metadata *Type),
                     (Name, File, Line, GetterName, SetterName, Attributes,
                      Type))
 
-  TempMDObjCProperty clone() const { return cloneImpl(); }
+  TempDIObjCProperty clone() const { return cloneImpl(); }
 
   unsigned getLine() const { return Line; }
   unsigned getAttributes() const { return Attributes; }
   StringRef getName() const { return getStringOperand(0); }
-  MDFile *getFile() const { return cast_or_null<MDFile>(getRawFile()); }
+  DIFile *getFile() const { return cast_or_null<DIFile>(getRawFile()); }
   StringRef getGetterName() const { return getStringOperand(2); }
   StringRef getSetterName() const { return getStringOperand(3); }
 
@@ -2142,7 +2134,7 @@
   ///
   /// \note Objective-C doesn't have an ODR, so there is no benefit in storing
   /// a type ref here.
-  MDType *getType() const { return cast_or_null<MDType>(getRawType()); }
+  DIType *getType() const { return cast_or_null<DIType>(getRawType()); }
 
   StringRef getFilename() const {
     if (auto *F = getFile())
@@ -2162,56 +2154,56 @@
   Metadata *getRawType() const { return getOperand(4); }
 
   static bool classof(const Metadata *MD) {
-    return MD->getMetadataID() == MDObjCPropertyKind;
+    return MD->getMetadataID() == DIObjCPropertyKind;
   }
 };
 
 /// \brief An imported module (C++ using directive or similar).
-class MDImportedEntity : public DebugNode {
+class DIImportedEntity : public DINode {
   friend class LLVMContextImpl;
   friend class MDNode;
 
   unsigned Line;
 
-  MDImportedEntity(LLVMContext &C, StorageType Storage, unsigned Tag,
+  DIImportedEntity(LLVMContext &C, StorageType Storage, unsigned Tag,
                    unsigned Line, ArrayRef<Metadata *> Ops)
-      : DebugNode(C, MDImportedEntityKind, Storage, Tag, Ops), Line(Line) {}
-  ~MDImportedEntity() = default;
+      : DINode(C, DIImportedEntityKind, Storage, Tag, Ops), Line(Line) {}
+  ~DIImportedEntity() = default;
 
-  static MDImportedEntity *getImpl(LLVMContext &Context, unsigned Tag,
-                                   MDScope *Scope, DebugNodeRef Entity,
+  static DIImportedEntity *getImpl(LLVMContext &Context, unsigned Tag,
+                                   DIScope *Scope, DINodeRef Entity,
                                    unsigned Line, StringRef Name,
                                    StorageType Storage,
                                    bool ShouldCreate = true) {
     return getImpl(Context, Tag, Scope, Entity, Line,
                    getCanonicalMDString(Context, Name), Storage, ShouldCreate);
   }
-  static MDImportedEntity *getImpl(LLVMContext &Context, unsigned Tag,
+  static DIImportedEntity *getImpl(LLVMContext &Context, unsigned Tag,
                                    Metadata *Scope, Metadata *Entity,
                                    unsigned Line, MDString *Name,
                                    StorageType Storage,
                                    bool ShouldCreate = true);
 
-  TempMDImportedEntity cloneImpl() const {
+  TempDIImportedEntity cloneImpl() const {
     return getTemporary(getContext(), getTag(), getScope(), getEntity(),
                         getLine(), getName());
   }
 
 public:
-  DEFINE_MDNODE_GET(MDImportedEntity,
-                    (unsigned Tag, MDScope *Scope, DebugNodeRef Entity,
+  DEFINE_MDNODE_GET(DIImportedEntity,
+                    (unsigned Tag, DIScope *Scope, DINodeRef Entity,
                      unsigned Line, StringRef Name = ""),
                     (Tag, Scope, Entity, Line, Name))
-  DEFINE_MDNODE_GET(MDImportedEntity,
+  DEFINE_MDNODE_GET(DIImportedEntity,
                     (unsigned Tag, Metadata *Scope, Metadata *Entity,
                      unsigned Line, MDString *Name),
                     (Tag, Scope, Entity, Line, Name))
 
-  TempMDImportedEntity clone() const { return cloneImpl(); }
+  TempDIImportedEntity clone() const { return cloneImpl(); }
 
   unsigned getLine() const { return Line; }
-  MDScope *getScope() const { return cast_or_null<MDScope>(getRawScope()); }
-  DebugNodeRef getEntity() const { return DebugNodeRef(getRawEntity()); }
+  DIScope *getScope() const { return cast_or_null<DIScope>(getRawScope()); }
+  DINodeRef getEntity() const { return DINodeRef(getRawEntity()); }
   StringRef getName() const { return getStringOperand(2); }
 
   Metadata *getRawScope() const { return getOperand(0); }
@@ -2219,7 +2211,7 @@
   MDString *getRawName() const { return getOperandAs<MDString>(2); }
 
   static bool classof(const Metadata *MD) {
-    return MD->getMetadataID() == MDImportedEntityKind;
+    return MD->getMetadataID() == DIImportedEntityKind;
   }
 };
 
diff --git a/llvm/include/llvm/IR/DebugLoc.h b/llvm/include/llvm/IR/DebugLoc.h
index f88a7b1..8ea5875 100644
--- a/llvm/include/llvm/IR/DebugLoc.h
+++ b/llvm/include/llvm/IR/DebugLoc.h
@@ -22,14 +22,14 @@
 
   class LLVMContext;
   class raw_ostream;
-  class MDLocation;
+  class DILocation;
 
   /// \brief A debug info location.
   ///
-  /// This class is a wrapper around a tracking reference to an \a MDLocation
+  /// This class is a wrapper around a tracking reference to an \a DILocation
   /// pointer.
   ///
-  /// To avoid extra includes, \a DebugLoc doubles the \a MDLocation API with a
+  /// To avoid extra includes, \a DebugLoc doubles the \a DILocation API with a
   /// one based on relatively opaque \a MDNode pointers.
   class DebugLoc {
     TrackingMDNodeRef Loc;
@@ -47,31 +47,31 @@
       return *this;
     }
 
-    /// \brief Construct from an \a MDLocation.
-    DebugLoc(const MDLocation *L);
+    /// \brief Construct from an \a DILocation.
+    DebugLoc(const DILocation *L);
 
     /// \brief Construct from an \a MDNode.
     ///
-    /// Note: if \c N is not an \a MDLocation, a verifier check will fail, and
+    /// Note: if \c N is not an \a DILocation, a verifier check will fail, and
     /// accessors will crash.  However, construction from other nodes is
     /// supported in order to handle forward references when reading textual
     /// IR.
     explicit DebugLoc(const MDNode *N);
 
-    /// \brief Get the underlying \a MDLocation.
+    /// \brief Get the underlying \a DILocation.
     ///
-    /// \pre !*this or \c isa<MDLocation>(getAsMDNode()).
+    /// \pre !*this or \c isa<DILocation>(getAsMDNode()).
     /// @{
-    MDLocation *get() const;
-    operator MDLocation *() const { return get(); }
-    MDLocation *operator->() const { return get(); }
-    MDLocation &operator*() const { return *get(); }
+    DILocation *get() const;
+    operator DILocation *() const { return get(); }
+    DILocation *operator->() const { return get(); }
+    DILocation &operator*() const { return *get(); }
     /// @}
 
     /// \brief Check for null.
     ///
     /// Check for null in a way that is safe with broken debug info.  Unlike
-    /// the conversion to \c MDLocation, this doesn't require that \c Loc is of
+    /// the conversion to \c DILocation, this doesn't require that \c Loc is of
     /// the right type.  Important for cases like \a llvm::StripDebugInfo() and
     /// \a Instruction::hasMetadata().
     explicit operator bool() const { return Loc; }
@@ -82,18 +82,18 @@
     /// \brief Create a new DebugLoc.
     ///
     /// Create a new DebugLoc at the specified line/col and scope/inline.  This
-    /// forwards to \a MDLocation::get().
+    /// forwards to \a DILocation::get().
     ///
     /// If \c !Scope, returns a default-constructed \a DebugLoc.
     ///
-    /// FIXME: Remove this.  Users should use MDLocation::get().
+    /// FIXME: Remove this.  Users should use DILocation::get().
     static DebugLoc get(unsigned Line, unsigned Col, const MDNode *Scope,
                         const MDNode *InlinedAt = nullptr);
 
     unsigned getLine() const;
     unsigned getCol() const;
     MDNode *getScope() const;
-    MDLocation *getInlinedAt() const;
+    DILocation *getInlinedAt() const;
 
     /// \brief Get the fully inlined-at scope for a DebugLoc.
     ///
@@ -105,8 +105,8 @@
     /// Walk up the scope chain of given debug loc and find line number info
     /// for the function.
     ///
-    /// FIXME: Remove this.  Users should use MDLocation/MDLocalScope API to
-    /// find the subprogram, and then MDLocation::get().
+    /// FIXME: Remove this.  Users should use DILocation/DILocalScope API to
+    /// find the subprogram, and then DILocation::get().
     DebugLoc getFnDebugLoc() const;
 
     /// \brief Return \c this as a bar \a MDNode.
diff --git a/llvm/include/llvm/IR/IntrinsicInst.h b/llvm/include/llvm/IR/IntrinsicInst.h
index bf0adc3..6d98134 100644
--- a/llvm/include/llvm/IR/IntrinsicInst.h
+++ b/llvm/include/llvm/IR/IntrinsicInst.h
@@ -82,11 +82,11 @@
   class DbgDeclareInst : public DbgInfoIntrinsic {
   public:
     Value *getAddress() const;
-    MDLocalVariable *getVariable() const {
-      return cast<MDLocalVariable>(getRawVariable());
+    DILocalVariable *getVariable() const {
+      return cast<DILocalVariable>(getRawVariable());
     }
-    MDExpression *getExpression() const {
-      return cast<MDExpression>(getRawExpression());
+    DIExpression *getExpression() const {
+      return cast<DIExpression>(getRawExpression());
     }
 
     Metadata *getRawVariable() const {
@@ -115,11 +115,11 @@
       return cast<ConstantInt>(
                           const_cast<Value*>(getArgOperand(1)))->getZExtValue();
     }
-    MDLocalVariable *getVariable() const {
-      return cast<MDLocalVariable>(getRawVariable());
+    DILocalVariable *getVariable() const {
+      return cast<DILocalVariable>(getRawVariable());
     }
-    MDExpression *getExpression() const {
-      return cast<MDExpression>(getRawExpression());
+    DIExpression *getExpression() const {
+      return cast<DIExpression>(getRawExpression());
     }
 
     Metadata *getRawVariable() const {
diff --git a/llvm/include/llvm/IR/Metadata.def b/llvm/include/llvm/IR/Metadata.def
index 0eb29bc..f2abff4 100644
--- a/llvm/include/llvm/IR/Metadata.def
+++ b/llvm/include/llvm/IR/Metadata.def
@@ -60,36 +60,36 @@
 HANDLE_METADATA_LEAF(LocalAsMetadata)
 HANDLE_MDNODE_BRANCH(MDNode)
 HANDLE_MDNODE_LEAF(MDTuple)
-HANDLE_SPECIALIZED_MDNODE_LEAF(MDLocation)
-HANDLE_SPECIALIZED_MDNODE_LEAF(MDExpression)
-HANDLE_SPECIALIZED_MDNODE_BRANCH(DebugNode)
-HANDLE_SPECIALIZED_MDNODE_LEAF(GenericDebugNode)
-HANDLE_SPECIALIZED_MDNODE_LEAF(MDSubrange)
-HANDLE_SPECIALIZED_MDNODE_LEAF(MDEnumerator)
-HANDLE_SPECIALIZED_MDNODE_BRANCH(MDScope)
-HANDLE_SPECIALIZED_MDNODE_BRANCH(MDType)
-HANDLE_SPECIALIZED_MDNODE_LEAF(MDBasicType)
-HANDLE_SPECIALIZED_MDNODE_BRANCH(MDDerivedTypeBase)
-HANDLE_SPECIALIZED_MDNODE_LEAF(MDDerivedType)
-HANDLE_SPECIALIZED_MDNODE_BRANCH(MDCompositeTypeBase)
-HANDLE_SPECIALIZED_MDNODE_LEAF(MDCompositeType)
-HANDLE_SPECIALIZED_MDNODE_LEAF(MDSubroutineType)
-HANDLE_SPECIALIZED_MDNODE_LEAF(MDFile)
-HANDLE_SPECIALIZED_MDNODE_LEAF(MDCompileUnit)
-HANDLE_SPECIALIZED_MDNODE_BRANCH(MDLocalScope)
-HANDLE_SPECIALIZED_MDNODE_LEAF(MDSubprogram)
-HANDLE_SPECIALIZED_MDNODE_BRANCH(MDLexicalBlockBase)
-HANDLE_SPECIALIZED_MDNODE_LEAF(MDLexicalBlock)
-HANDLE_SPECIALIZED_MDNODE_LEAF(MDLexicalBlockFile)
-HANDLE_SPECIALIZED_MDNODE_LEAF(MDNamespace)
-HANDLE_SPECIALIZED_MDNODE_BRANCH(MDTemplateParameter)
-HANDLE_SPECIALIZED_MDNODE_LEAF(MDTemplateTypeParameter)
-HANDLE_SPECIALIZED_MDNODE_LEAF(MDTemplateValueParameter)
-HANDLE_SPECIALIZED_MDNODE_BRANCH(MDVariable)
-HANDLE_SPECIALIZED_MDNODE_LEAF(MDGlobalVariable)
-HANDLE_SPECIALIZED_MDNODE_LEAF(MDLocalVariable)
-HANDLE_SPECIALIZED_MDNODE_LEAF(MDObjCProperty)
-HANDLE_SPECIALIZED_MDNODE_LEAF(MDImportedEntity)
+HANDLE_SPECIALIZED_MDNODE_LEAF(DILocation)
+HANDLE_SPECIALIZED_MDNODE_LEAF(DIExpression)
+HANDLE_SPECIALIZED_MDNODE_BRANCH(DINode)
+HANDLE_SPECIALIZED_MDNODE_LEAF(GenericDINode)
+HANDLE_SPECIALIZED_MDNODE_LEAF(DISubrange)
+HANDLE_SPECIALIZED_MDNODE_LEAF(DIEnumerator)
+HANDLE_SPECIALIZED_MDNODE_BRANCH(DIScope)
+HANDLE_SPECIALIZED_MDNODE_BRANCH(DIType)
+HANDLE_SPECIALIZED_MDNODE_LEAF(DIBasicType)
+HANDLE_SPECIALIZED_MDNODE_BRANCH(DIDerivedTypeBase)
+HANDLE_SPECIALIZED_MDNODE_LEAF(DIDerivedType)
+HANDLE_SPECIALIZED_MDNODE_BRANCH(DICompositeTypeBase)
+HANDLE_SPECIALIZED_MDNODE_LEAF(DICompositeType)
+HANDLE_SPECIALIZED_MDNODE_LEAF(DISubroutineType)
+HANDLE_SPECIALIZED_MDNODE_LEAF(DIFile)
+HANDLE_SPECIALIZED_MDNODE_LEAF(DICompileUnit)
+HANDLE_SPECIALIZED_MDNODE_BRANCH(DILocalScope)
+HANDLE_SPECIALIZED_MDNODE_LEAF(DISubprogram)
+HANDLE_SPECIALIZED_MDNODE_BRANCH(DILexicalBlockBase)
+HANDLE_SPECIALIZED_MDNODE_LEAF(DILexicalBlock)
+HANDLE_SPECIALIZED_MDNODE_LEAF(DILexicalBlockFile)
+HANDLE_SPECIALIZED_MDNODE_LEAF(DINamespace)
+HANDLE_SPECIALIZED_MDNODE_BRANCH(DITemplateParameter)
+HANDLE_SPECIALIZED_MDNODE_LEAF(DITemplateTypeParameter)
+HANDLE_SPECIALIZED_MDNODE_LEAF(DITemplateValueParameter)
+HANDLE_SPECIALIZED_MDNODE_BRANCH(DIVariable)
+HANDLE_SPECIALIZED_MDNODE_LEAF(DIGlobalVariable)
+HANDLE_SPECIALIZED_MDNODE_LEAF(DILocalVariable)
+HANDLE_SPECIALIZED_MDNODE_LEAF(DIObjCProperty)
+HANDLE_SPECIALIZED_MDNODE_LEAF(DIImportedEntity)
 
 #undef HANDLE_METADATA
 #undef HANDLE_METADATA_LEAF
diff --git a/llvm/include/llvm/IR/Metadata.h b/llvm/include/llvm/IR/Metadata.h
index 03e70fe..60718f5 100644
--- a/llvm/include/llvm/IR/Metadata.h
+++ b/llvm/include/llvm/IR/Metadata.h
@@ -59,27 +59,27 @@
 public:
   enum MetadataKind {
     MDTupleKind,
-    MDLocationKind,
-    GenericDebugNodeKind,
-    MDSubrangeKind,
-    MDEnumeratorKind,
-    MDBasicTypeKind,
-    MDDerivedTypeKind,
-    MDCompositeTypeKind,
-    MDSubroutineTypeKind,
-    MDFileKind,
-    MDCompileUnitKind,
-    MDSubprogramKind,
-    MDLexicalBlockKind,
-    MDLexicalBlockFileKind,
-    MDNamespaceKind,
-    MDTemplateTypeParameterKind,
-    MDTemplateValueParameterKind,
-    MDGlobalVariableKind,
-    MDLocalVariableKind,
-    MDExpressionKind,
-    MDObjCPropertyKind,
-    MDImportedEntityKind,
+    DILocationKind,
+    GenericDINodeKind,
+    DISubrangeKind,
+    DIEnumeratorKind,
+    DIBasicTypeKind,
+    DIDerivedTypeKind,
+    DICompositeTypeKind,
+    DISubroutineTypeKind,
+    DIFileKind,
+    DICompileUnitKind,
+    DISubprogramKind,
+    DILexicalBlockKind,
+    DILexicalBlockFileKind,
+    DINamespaceKind,
+    DITemplateTypeParameterKind,
+    DITemplateValueParameterKind,
+    DIGlobalVariableKind,
+    DILocalVariableKind,
+    DIExpressionKind,
+    DIObjCPropertyKind,
+    DIImportedEntityKind,
     ConstantAsMetadataKind,
     LocalAsMetadataKind,
     MDStringKind