Author: rafael
Date: Tue Mar 20 13:42:55 2018
New Revision: 328040

URL: http://llvm.org/viewvc/llvm-project?rev=328040&view=rev
Log:
Set dso_local on string literals.
Modified:
    cfe/trunk/lib/CodeGen/CodeGenModule.cpp
    cfe/trunk/test/CodeGen/c-strings.c
    cfe/trunk/test/CodeGen/string-literal-short-wstring.c
    cfe/trunk/test/CodeGen/wchar-const.c
    cfe/trunk/test/CodeGenCXX/funcsig.cpp
    cfe/trunk/test/CodeGenCXX/ms_wide_predefined_expr.cpp

Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=328040&r1=328039&r2=328040&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Tue Mar 20 13:42:55 2018
@@ -4016,6 +4016,7 @@ GenerateStringLiteral(llvm::Constant *C,
     assert(CGM.supportsCOMDAT() && "Only COFF uses weak string literals");
     GV->setComdat(M.getOrInsertComdat(GV->getName()));
   }
+  CGM.setDSOLocal(GV);
 
   return GV;
 }

Modified: cfe/trunk/test/CodeGen/c-strings.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/c-strings.c?rev=328040&r1=328039&r2=328040&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/c-strings.c (original)
+++ cfe/trunk/test/CodeGen/c-strings.c Tue Mar 20 13:42:55 2018
@@ -6,7 +6,7 @@
 
 // CHECK: @align = {{(dso_local )?}}global i8 [[ALIGN:[0-9]+]]
 // ITANIUM: @.str = private unnamed_addr constant [6 x i8] c"hello\00"
-// MSABI: @"??_C@_05CJBACGMB@hello?$AA@" = linkonce_odr unnamed_addr constant 
[6 x i8] c"hello\00", comdat, align 1
+// MSABI: @"??_C@_05CJBACGMB@hello?$AA@" = linkonce_odr dso_local unnamed_addr 
constant [6 x i8] c"hello\00", comdat, align 1
 // ITANIUM: @f1.x = internal global i8* getelementptr inbounds ([6 x i8], [6 x 
i8]* @.str, i32 0, i32 0)
 // MSABI: @f1.x = internal global i8* getelementptr inbounds ([6 x i8], [6 x 
i8]* @"??_C@_05CJBACGMB@hello?$AA@", i32 0, i32 0)
 // CHECK: @f2.x = internal global [6 x i8] c"hello\00", align [[ALIGN]]

Modified: cfe/trunk/test/CodeGen/string-literal-short-wstring.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/string-literal-short-wstring.c?rev=328040&r1=328039&r2=328040&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/string-literal-short-wstring.c (original)
+++ cfe/trunk/test/CodeGen/string-literal-short-wstring.c Tue Mar 20 13:42:55 
2018
@@ -12,12 +12,12 @@ int main() {
   char b[10] = "\u1120\u0220\U00102030";
 
   // ITANIUM: private unnamed_addr constant [3 x i16] [i16 65, i16 66, i16 0]
-  // MSABI: linkonce_odr unnamed_addr constant [3 x i16] [i16 65, i16 66, i16 
0]
+  // MSABI: linkonce_odr dso_local unnamed_addr constant [3 x i16] [i16 65, 
i16 66, i16 0]
   const wchar_t *foo = L"AB";
 
   // This should convert to utf16.
   // ITANIUM: private unnamed_addr constant [5 x i16] [i16 4384, i16 544, i16 
-9272, i16 -9168, i16 0]
-  // MSABI: linkonce_odr unnamed_addr constant [5 x i16] [i16 4384, i16 544, 
i16 -9272, i16 -9168, i16 0]
+  // MSABI: linkonce_odr dso_local unnamed_addr constant [5 x i16] [i16 4384, 
i16 544, i16 -9272, i16 -9168, i16 0]
   const wchar_t *bar = L"\u1120\u0220\U00102030";
 
 

Modified: cfe/trunk/test/CodeGen/wchar-const.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/wchar-const.c?rev=328040&r1=328039&r2=328040&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/wchar-const.c (original)
+++ cfe/trunk/test/CodeGen/wchar-const.c Tue Mar 20 13:42:55 2018
@@ -15,7 +15,7 @@ typedef __WCHAR_TYPE__ wchar_t;
 
 
 // CHECK-DAR: private unnamed_addr constant [18 x i32] [i32 84,
-// CHECK-WIN: linkonce_odr unnamed_addr constant [18 x i16] [i16 84,
+// CHECK-WIN: linkonce_odr dso_local unnamed_addr constant [18 x i16] [i16 84,
 extern void foo(const wchar_t* p);
 int main (int argc, const char * argv[])
 {

Modified: cfe/trunk/test/CodeGenCXX/funcsig.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/funcsig.cpp?rev=328040&r1=328039&r2=328040&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/funcsig.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/funcsig.cpp Tue Mar 20 13:42:55 2018
@@ -12,24 +12,24 @@ int printf(const char *, ...);
 void funcNoProto() {
   printf("__FUNCSIG__ %s\n\n", __FUNCSIG__);
 }
-// CHECK-C:   @"??_C@_0BL@IHLLLCAO@void?5__cdecl?5funcNoProto?$CI?$CJ?$AA@" = 
linkonce_odr unnamed_addr constant [27 x i8] c"void __cdecl funcNoProto()\00"
-// CHECK-CXX: 
@"??_C@_0BP@PJOECCJN@void?5__cdecl?5funcNoProto?$CIvoid?$CJ?$AA@" = 
linkonce_odr unnamed_addr constant [31 x i8] c"void __cdecl 
funcNoProto(void)\00"
+// CHECK-C:   @"??_C@_0BL@IHLLLCAO@void?5__cdecl?5funcNoProto?$CI?$CJ?$AA@" = 
linkonce_odr dso_local unnamed_addr constant [27 x i8] c"void __cdecl 
funcNoProto()\00"
+// CHECK-CXX: 
@"??_C@_0BP@PJOECCJN@void?5__cdecl?5funcNoProto?$CIvoid?$CJ?$AA@" = 
linkonce_odr dso_local unnamed_addr constant [31 x i8] c"void __cdecl 
funcNoProto(void)\00"
 
 void funcNoParams(void) {
   printf("__FUNCSIG__ %s\n\n", __FUNCSIG__);
 }
-// CHECK: @"??_C@_0CA@GBIDFNBN@void?5__cdecl?5funcNoParams?$CIvoid?$CJ?$AA@" = 
linkonce_odr unnamed_addr constant [32 x i8] c"void __cdecl 
funcNoParams(void)\00"
+// CHECK: @"??_C@_0CA@GBIDFNBN@void?5__cdecl?5funcNoParams?$CIvoid?$CJ?$AA@" = 
linkonce_odr dso_local unnamed_addr constant [32 x i8] c"void __cdecl 
funcNoParams(void)\00"
 
 void freeFunc(int *p, char c) {
   printf("__FUNCSIG__ %s\n\n", __FUNCSIG__);
 }
-// CHECK: @"??_C@_0CD@KLGMNNL@void?5__cdecl?5freeFunc?$CIint?5?$CK?0?5cha@" = 
linkonce_odr unnamed_addr constant [{{.*}} x i8] c"void __cdecl freeFunc(int *, 
char)\00"
+// CHECK: @"??_C@_0CD@KLGMNNL@void?5__cdecl?5freeFunc?$CIint?5?$CK?0?5cha@" = 
linkonce_odr dso_local unnamed_addr constant [{{.*}} x i8] c"void __cdecl 
freeFunc(int *, char)\00"
 
 #ifdef __cplusplus
 void funcVarargs(...) {
   printf("__FUNCSIG__ %s\n\n", __FUNCSIG__);
 }
-// CHECK-CXX: 
@"??_C@_0BO@BOBPLEKP@void?5__cdecl?5funcVarargs?$CI?4?4?4?$CJ?$AA@" = 
linkonce_odr unnamed_addr constant [30 x i8] c"void __cdecl funcVarargs(...)\00"
+// CHECK-CXX: 
@"??_C@_0BO@BOBPLEKP@void?5__cdecl?5funcVarargs?$CI?4?4?4?$CJ?$AA@" = 
linkonce_odr dso_local unnamed_addr constant [30 x i8] c"void __cdecl 
funcVarargs(...)\00"
 
 struct TopLevelClass {
   void topLevelMethod(int *, char);
@@ -37,7 +37,7 @@ struct TopLevelClass {
 void TopLevelClass::topLevelMethod(int *, char) {
   printf("__FUNCSIG__ %s\n\n", __FUNCSIG__);
 }
-// CHECK-CXX: @"??_C@_0DL@OBHNMDP@void?5__thiscall?5TopLevelClass?3?3t@" = 
linkonce_odr unnamed_addr constant [{{.*}} x i8] c"void __thiscall 
TopLevelClass::topLevelMethod(int *, char)\00"
+// CHECK-CXX: @"??_C@_0DL@OBHNMDP@void?5__thiscall?5TopLevelClass?3?3t@" = 
linkonce_odr dso_local unnamed_addr constant [{{.*}} x i8] c"void __thiscall 
TopLevelClass::topLevelMethod(int *, char)\00"
 
 namespace NS {
 struct NamespacedClass {
@@ -46,6 +46,6 @@ struct NamespacedClass {
 void NamespacedClass::namespacedMethod(int *, char) {
   printf("__FUNCSIG__ %s\n\n", __FUNCSIG__);
 }
-// CHECK-CXX: @"??_C@_0ED@PFDKIEBA@void?5__thiscall?5NS?3?3NamespacedCl@" = 
linkonce_odr unnamed_addr constant [{{.*}} x i8] c"void __thiscall 
NS::NamespacedClass::namespacedMethod(int *, char)\00"
+// CHECK-CXX: @"??_C@_0ED@PFDKIEBA@void?5__thiscall?5NS?3?3NamespacedCl@" = 
linkonce_odr dso_local unnamed_addr constant [{{.*}} x i8] c"void __thiscall 
NS::NamespacedClass::namespacedMethod(int *, char)\00"
 }
 #endif

Modified: cfe/trunk/test/CodeGenCXX/ms_wide_predefined_expr.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/ms_wide_predefined_expr.cpp?rev=328040&r1=328039&r2=328040&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/ms_wide_predefined_expr.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/ms_wide_predefined_expr.cpp Tue Mar 20 13:42:55 
2018
@@ -1,6 +1,6 @@
 // RUN: %clang_cc1 %s -fms-extensions -triple i686-pc-win32 -emit-llvm -o - | 
FileCheck %s
 
-// CHECK: @"??_C@_19DPFBEKIN@?$AAf?$AAu?$AAn?$AAc?$AA?$AA@" = linkonce_odr 
unnamed_addr constant [5 x i16] [i16 102, i16 117, i16 110, i16 99, i16 0], 
comdat, align 2
+// CHECK: @"??_C@_19DPFBEKIN@?$AAf?$AAu?$AAn?$AAc?$AA?$AA@" = linkonce_odr 
dso_local unnamed_addr constant [5 x i16] [i16 102, i16 117, i16 110, i16 99, 
i16 0], comdat, align 2
 
 void wprint(const wchar_t*);
 


_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to