[DebugInfo] Delete TypedDINodeRef
TypedDINodeRef<T> is a redundant wrapper of Metadata * that is actually a T *.
Accordingly, change DI{Node,Scope,Type}Ref uses to DI{Node,Scope,Type} * or their const variants.
This allows us to delete many resolve() calls that clutter the code.
Reviewed By: rnk
Differential Revision: https://reviews.llvm.org/D61369
llvm-svn: 360108
diff --git a/llvm/lib/IR/DebugInfo.cpp b/llvm/lib/IR/DebugInfo.cpp
index 6957904..ce47ef2 100644
--- a/llvm/lib/IR/DebugInfo.cpp
+++ b/llvm/lib/IR/DebugInfo.cpp
@@ -81,7 +81,7 @@
continue;
auto *GV = DIG->getVariable();
processScope(GV->getScope());
- processType(GV->getType().resolve());
+ processType(GV->getType());
}
for (auto *ET : CU->getEnumTypes())
processType(ET);
@@ -91,7 +91,7 @@
else
processSubprogram(cast<DISubprogram>(RT));
for (auto *Import : CU->getImportedEntities()) {
- auto *Entity = Import->getEntity().resolve();
+ auto *Entity = Import->getEntity();
if (auto *T = dyn_cast<DIType>(Entity))
processType(T);
else if (auto *SP = dyn_cast<DISubprogram>(Entity))
@@ -124,14 +124,14 @@
void DebugInfoFinder::processType(DIType *DT) {
if (!addType(DT))
return;
- processScope(DT->getScope().resolve());
+ processScope(DT->getScope());
if (auto *ST = dyn_cast<DISubroutineType>(DT)) {
- for (DITypeRef Ref : ST->getTypeArray())
- processType(Ref.resolve());
+ for (DIType *Ref : ST->getTypeArray())
+ processType(Ref);
return;
}
if (auto *DCT = dyn_cast<DICompositeType>(DT)) {
- processType(DCT->getBaseType().resolve());
+ processType(DCT->getBaseType());
for (Metadata *D : DCT->getElements()) {
if (auto *T = dyn_cast<DIType>(D))
processType(T);
@@ -141,7 +141,7 @@
return;
}
if (auto *DDT = dyn_cast<DIDerivedType>(DT)) {
- processType(DDT->getBaseType().resolve());
+ processType(DDT->getBaseType());
}
}
@@ -174,7 +174,7 @@
void DebugInfoFinder::processSubprogram(DISubprogram *SP) {
if (!addSubprogram(SP))
return;
- processScope(SP->getScope().resolve());
+ processScope(SP->getScope());
// Some of the users, e.g. CloneFunctionInto / CloneModule, need to set up a
// ValueMap containing identity mappings for all of the DICompileUnit's, not
// just DISubprogram's, referenced from anywhere within the Function being
@@ -187,9 +187,9 @@
processType(SP->getType());
for (auto *Element : SP->getTemplateParams()) {
if (auto *TType = dyn_cast<DITemplateTypeParameter>(Element)) {
- processType(TType->getType().resolve());
+ processType(TType->getType());
} else if (auto *TVal = dyn_cast<DITemplateValueParameter>(Element)) {
- processType(TVal->getType().resolve());
+ processType(TVal->getType());
}
}
}
@@ -207,7 +207,7 @@
if (!NodesSeen.insert(DV).second)
return;
processScope(DV->getScope());
- processType(DV->getType().resolve());
+ processType(DV->getType());
}
void DebugInfoFinder::processValue(const Module &M, const DbgValueInst *DVI) {
@@ -222,7 +222,7 @@
if (!NodesSeen.insert(DV).second)
return;
processScope(DV->getScope());
- processType(DV->getType().resolve());
+ processType(DV->getType());
}
bool DebugInfoFinder::addType(DIType *DT) {
@@ -428,7 +428,8 @@
StringRef LinkageName = MDS->getName().empty() ? MDS->getLinkageName() : "";
DISubprogram *Declaration = nullptr;
auto *Type = cast_or_null<DISubroutineType>(map(MDS->getType()));
- DITypeRef ContainingType(map(MDS->getContainingType()));
+ DIType *ContainingType =
+ cast_or_null<DIType>(map(MDS->getContainingType()));
auto *Unit = cast_or_null<DICompileUnit>(map(MDS->getUnit()));
auto Variables = nullptr;
auto TemplateParams = nullptr;