Skip to content

Commit ffc4ffe

Browse files
committed
more DEBUGGING
1 parent 74d13e3 commit ffc4ffe

File tree

2 files changed

+35
-9
lines changed

2 files changed

+35
-9
lines changed

include/swift/IRGen/Linking.h

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1630,12 +1630,23 @@ class ApplyIRLinkage {
16301630

16311631
// COMDATs cannot be applied to declarations. If we have a definition,
16321632
// apply the COMDAT.
1633-
if (definition)
1633+
if (definition) {
16341634
if (IRL.Linkage == llvm::GlobalValue::LinkOnceODRLinkage ||
1635-
IRL.Linkage == llvm::GlobalValue::WeakODRLinkage)
1636-
if (Triple.supportsCOMDAT())
1637-
if (llvm::GlobalObject *GO = dyn_cast<llvm::GlobalObject>(GV))
1635+
IRL.Linkage == llvm::GlobalValue::WeakODRLinkage) {
1636+
if (Triple.supportsCOMDAT()) {
1637+
if (llvm::GlobalObject *GO = dyn_cast<llvm::GlobalObject>(GV)) {
1638+
if (GV->getName().equals("$sSo18CFDateFormatterRefaMf")) {
1639+
llvm::dbgs() << "Setting comdat in" << M->getName() << "\n";
1640+
}
16381641
GO->setComdat(M->getOrInsertComdat(GV->getName()));
1642+
GV->dump();
1643+
}
1644+
}
1645+
} else if (GV->getName().equals("$sSo18CFDateFormatterRefaMf")){
1646+
llvm::dbgs() << "Not setting comdat in " << M->getName() << "\n";
1647+
GV->dump();
1648+
}
1649+
}
16391650
}
16401651
};
16411652

lib/IRGen/GenDecl.cpp

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2705,9 +2705,6 @@ Address IRGenModule::getAddrOfSILGlobalVariable(SILGlobalVariable *var,
27052705
gvar->setInitializer(llvm::Constant::getNullValue(storageTypeWithContainer));
27062706
else
27072707
gvar->setComdat(nullptr);
2708-
if (gvar->getName().equals("$sSo18CFDateFormatterRefaMf")) {
2709-
gvar->dump();
2710-
}
27112708
}
27122709
llvm::Constant *addr = gvar;
27132710
if (var->isInitializedObject() && !canMakeStaticObjectsReadOnly()) {
@@ -5040,7 +5037,8 @@ IRGenModule::getAddrOfTypeMetadata(CanType concreteType,
50405037
SymbolReferenceKind refKind,
50415038
TypeMetadataCanonicality canonicality) {
50425039
assert(!isa<UnboundGenericType>(concreteType));
5043-
5040+
if (concreteType->getString() == "") {
5041+
}
50445042
auto nominal = concreteType->getAnyNominal();
50455043

50465044
bool foreign = nominal && requiresForeignTypeMetadata(nominal);
@@ -5133,8 +5131,25 @@ IRGenModule::getAddrOfTypeMetadata(CanType concreteType,
51335131
typeOfValue = defaultVarTy;
51345132
}
51355133

5136-
if (auto *GV = dyn_cast<llvm::GlobalVariable>(addr.getValue()))
5134+
if (auto *GV = dyn_cast<llvm::GlobalVariable>(addr.getValue())) {
5135+
5136+
if (addr.getValue()->getName().equals("$sSo18CFDateFormatterRefaMf")) {
5137+
llvm::dbgs() << "Potentially removing COMDAT isDeclaration:" << GV->isDeclaration() << "\n";
5138+
addr.getValue()->dump();
5139+
}
51375140
GV->setComdat(nullptr);
5141+
if (addr.getValue()->getName().equals("$sSo18CFDateFormatterRefaMf")) {
5142+
addr.getValue()->dump();
5143+
llvm::dbgs() << "concreteType: " << concreteType->getString() << "\n";
5144+
}
5145+
} else {
5146+
if (addr.getValue()->getName().equals("$sSo18CFDateFormatterRefaMf")) {
5147+
llvm::dbgs() << "Not removing COMDAT \n";
5148+
addr.getValue()->dump();
5149+
llvm::dbgs() << "concreteType: " << concreteType->getString() << "\n";
5150+
}
5151+
}
5152+
51385153

51395154
// FIXME: MC breaks when emitting alias references on some platforms
51405155
// (rdar://problem/22450593 ). Work around this by referring to the aliasee

0 commit comments

Comments
 (0)