Skip to content

Commit 47e0f9e

Browse files
committed
Use stringmap to deduplicate strings by their section name
1 parent 9e30ce3 commit 47e0f9e

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

lib/IRGen/GenDecl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6052,7 +6052,7 @@ IRGenModule::getAddrOfGlobalString(StringRef data, CStringSectionType type,
60526052
}
60536053

60546054
// Check whether this string already exists.
6055-
auto &entry = GlobalStrings[type][data];
6055+
auto &entry = GlobalStrings[sectionName][data];
60566056

60576057
if (entry.second) {
60586058
// FIXME: Clear unnamed_addr if the global will be relative referenced

lib/IRGen/IRGenModule.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1339,8 +1339,8 @@ class IRGenModule {
13391339
llvm::DenseMap<LinkEntity, llvm::Constant*> GlobalGOTEquivalents;
13401340
llvm::DenseMap<LinkEntity, llvm::Function*> GlobalFuncs;
13411341
llvm::DenseSet<const clang::Decl *> GlobalClangDecls;
1342-
llvm::DenseMap<
1343-
CStringSectionType,
1342+
// Maps sectionName -> string data -> constant
1343+
llvm::StringMap<
13441344
llvm::StringMap<std::pair<llvm::GlobalVariable *, llvm::Constant *>>>
13451345
GlobalStrings;
13461346
llvm::StringMap<llvm::Constant*> GlobalUTF16Strings;

test/IRGen/objc_extensions.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import objc_extension_base
1313
// Check that metadata for nested enums added in extensions to imported classes
1414
// gets emitted concretely.
1515

16-
// CHECK: [[CATEGORY_NAME:@.*]] = private constant [16 x i8] c"objc_extensions\00"
16+
// CHECK: [[CATEGORY_NAME:@.*]] = private unnamed_addr constant [16 x i8] c"objc_extensions\00"
1717
// CHECK: [[METHOD_TYPE:@.*]] = private unnamed_addr constant [8 x i8] c"v16@0:8\00"
1818

1919
// CHECK-LABEL: @"_CATEGORY_PROTOCOLS_Gizmo_$_objc_extensions" = internal constant

0 commit comments

Comments
 (0)