[PATCH] D25529: LTO: Use the correct mangler function in LTOCodeGenerator::applyScopeRestrictions().

Peter Collingbourne via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 12 13:21:22 PDT 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL284040: LTO: Use the correct mangler function in LTOCodeGenerator… (authored by pcc).

Changed prior to commit:
  https://reviews.llvm.org/D25529?vs=74418&id=74428#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D25529

Files:
  llvm/trunk/lib/LTO/LTOCodeGenerator.cpp
  llvm/trunk/test/LTO/X86/stdcall.ll


Index: llvm/trunk/test/LTO/X86/stdcall.ll
===================================================================
--- llvm/trunk/test/LTO/X86/stdcall.ll
+++ llvm/trunk/test/LTO/X86/stdcall.ll
@@ -0,0 +1,10 @@
+; RUN: llvm-as < %s > %t
+; RUN: llvm-lto -exported-symbol=_DllMain at 12 -filetype=asm -o - %t | FileCheck %s
+
+target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32"
+target triple = "i386-pc-windows-msvc19.0.23918"
+
+; CHECK: .globl _DllMain at 12
+define x86_stdcallcc i32 @DllMain(i8* %module, i32 %reason, i8* %reserved) {
+  ret i32 1
+}
Index: llvm/trunk/lib/LTO/LTOCodeGenerator.cpp
===================================================================
--- llvm/trunk/lib/LTO/LTOCodeGenerator.cpp
+++ llvm/trunk/lib/LTO/LTOCodeGenerator.cpp
@@ -410,6 +410,7 @@
 
   // Declare a callback for the internalize pass that will ask for every
   // candidate GlobalValue if it can be internalized or not.
+  Mangler Mang;
   SmallString<64> MangledName;
   auto mustPreserveGV = [&](const GlobalValue &GV) -> bool {
     // Unnamed globals can't be mangled, but they can't be preserved either.
@@ -421,8 +422,7 @@
     // underscore.
     MangledName.clear();
     MangledName.reserve(GV.getName().size() + 1);
-    Mangler::getNameWithPrefix(MangledName, GV.getName(),
-                               MergedModule->getDataLayout());
+    Mang.getNameWithPrefix(MangledName, &GV, /*CannotUsePrivateLabel=*/false);
     return MustPreserveSymbols.count(MangledName);
   };
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D25529.74428.patch
Type: text/x-patch
Size: 1492 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161012/64e2b078/attachment.bin>


More information about the llvm-commits mailing list