[PATCH] D77429: [AsmPrinter] Do not define local aliases for global objects in a comdat
Leonard Chan via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 6 13:04:51 PDT 2020
leonardchan updated this revision to Diff 255452.
leonardchan marked an inline comment as done.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D77429/new/
https://reviews.llvm.org/D77429
Files:
llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
llvm/test/CodeGen/X86/semantic-interposition-comdat.ll
Index: llvm/test/CodeGen/X86/semantic-interposition-comdat.ll
===================================================================
--- /dev/null
+++ llvm/test/CodeGen/X86/semantic-interposition-comdat.ll
@@ -0,0 +1,23 @@
+; RUN: llc -mtriple x86_64-unknown-linux-gnu %s -o - | FileCheck %s
+
+$comdat_func = comdat any
+
+; CHECK-LABEL: func2:
+; CHECK-NEXT: .Lfunc2$local
+
+declare void @func()
+
+define hidden void @func2() {
+entry:
+ call void @func()
+ ret void
+}
+
+; CHECK: comdat_func:
+; CHECK-NOT: .Lcomdat_func$local
+
+define hidden void @comdat_func() comdat {
+entry:
+ call void @func()
+ ret void
+}
Index: llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
===================================================================
--- llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -460,7 +460,7 @@
// assumed it.
if (TM.getTargetTriple().isOSBinFormatELF() &&
GlobalObject::isExternalLinkage(GV.getLinkage()) && GV.isDSOLocal() &&
- !GV.isDeclaration() && !isa<GlobalIFunc>(GV))
+ !GV.isDeclaration() && !isa<GlobalIFunc>(GV) && !GV.hasComdat())
return getSymbolWithGlobalValueBase(&GV, "$local");
return TM.getSymbol(&GV);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77429.255452.patch
Type: text/x-patch
Size: 1214 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200406/d4035f03/attachment.bin>
More information about the llvm-commits
mailing list