[llvm] dfe55cc - [AIX] use the original name as the input to create the new symbol for TLS symbol.

via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 23 22:37:16 PDT 2022


Author: esmeyi
Date: 2022-08-24T01:36:40-04:00
New Revision: dfe55cc1cd247275fdefccae4fb3f2d01d7fde93

URL: https://github.com/llvm/llvm-project/commit/dfe55cc1cd247275fdefccae4fb3f2d01d7fde93
DIFF: https://github.com/llvm/llvm-project/commit/dfe55cc1cd247275fdefccae4fb3f2d01d7fde93.diff

LOG: [AIX] use the original name as the input to create the new symbol for TLS symbol.

Summary: Currently, an error was reported when a thread local symbol has an invalid name. D100956 create a new symbol to prefix the TLS symbol name with a dot. When the symbol name is renamed, the error occurs. This patch uses the original symbol name (name in the symbol table) as the input for the symbol for TOC entry.

Reviewed By: shchenz, lkail

Differential Revision: https://reviews.llvm.org/D132348

Added: 
    llvm/test/CodeGen/PowerPC/aix-xcoff-tls-rename.ll

Modified: 
    llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
index 58a75baf8081a..2f30e52bd0390 100644
--- a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
+++ b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
@@ -2564,7 +2564,7 @@ void PPCAIXAsmPrinter::emitEndOfAsmFile(Module &M) {
       SmallString<128> Name;
       StringRef Prefix = ".";
       Name += Prefix;
-      Name += I.first.first->getName();
+      Name += cast<MCSymbolXCOFF>(I.first.first)->getSymbolTableName();
       MCSymbol *S = OutContext.getOrCreateSymbol(Name);
       TCEntry = cast<MCSectionXCOFF>(
           getObjFileLowering().getSectionForTOCEntry(S, TM));

diff  --git a/llvm/test/CodeGen/PowerPC/aix-xcoff-tls-rename.ll b/llvm/test/CodeGen/PowerPC/aix-xcoff-tls-rename.ll
new file mode 100644
index 0000000000000..52cadcd5f1c54
--- /dev/null
+++ b/llvm/test/CodeGen/PowerPC/aix-xcoff-tls-rename.ll
@@ -0,0 +1,15 @@
+; RUN: llc -verify-machineinstrs -mtriple powerpc64-ibm-aix-xcoff -mcpu=pwr4 \
+; RUN:     -mattr=-altivec -data-sections=false -xcoff-traceback-table=false < %s | FileCheck %s
+
+; CHECK:      .extern .__tls_get_addr[PR]
+; CHECK-NEXT: .csect .tdata[TL],2
+; CHECK-NEXT: .globl  _Renamed..24f_f                 # @"f$f"
+; CHECK-NEXT: .rename _Renamed..24f_f,"f$f"
+
+@"f$f" = thread_local global i32 10, align 4
+
+define void @fun() {
+entry:
+  store i32 1, ptr @"f$f", align 4
+  ret void
+}


        


More information about the llvm-commits mailing list