aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Richardson <alexrichardson@google.com>2022-08-09 09:06:48 +0000
committerAlex Richardson <alexrichardson@google.com>2022-08-09 09:53:47 +0000
commit9a2b14afa02e46acbc7838bafa8d9e59b7cc86b8 (patch)
treeb57b6e888b180bade4145838f16e19a0fbd2ad8f
parent7925341d9332118c8f3469013b08cdcd9016749c (diff)
downloadllvm-9a2b14afa02e46acbc7838bafa8d9e59b7cc86b8.zip
llvm-9a2b14afa02e46acbc7838bafa8d9e59b7cc86b8.tar.gz
llvm-9a2b14afa02e46acbc7838bafa8d9e59b7cc86b8.tar.bz2
[ARM] Emit local aliases (.Lfoo$local) for functions
ARMAsmPrinter::emitFunctionEntryLabel() was not calling the base class function so the $local alias was not being emitted. This should not have any function effect right now since ARM does not generate different code for the $local symbols, but it could be improved in the future. Reviewed By: MaskRay Differential Revision: https://reviews.llvm.org/D131392
-rw-r--r--llvm/lib/Target/ARM/ARMAsmPrinter.cpp3
-rw-r--r--llvm/test/CodeGen/ARM/dso-local-func.ll3
-rw-r--r--llvm/utils/UpdateTestChecks/asm.py1
3 files changed, 3 insertions, 4 deletions
diff --git a/llvm/lib/Target/ARM/ARMAsmPrinter.cpp b/llvm/lib/Target/ARM/ARMAsmPrinter.cpp
index a7b63fc..c527830 100644
--- a/llvm/lib/Target/ARM/ARMAsmPrinter.cpp
+++ b/llvm/lib/Target/ARM/ARMAsmPrinter.cpp
@@ -82,8 +82,7 @@ void ARMAsmPrinter::emitFunctionEntryLabel() {
OutStreamer->emitSymbolAttribute(S, MCSA_ELF_TypeFunction);
OutStreamer->emitLabel(S);
}
-
- OutStreamer->emitLabel(CurrentFnSym);
+ AsmPrinter::emitFunctionEntryLabel();
}
void ARMAsmPrinter::emitXXStructor(const DataLayout &DL, const Constant *CV) {
diff --git a/llvm/test/CodeGen/ARM/dso-local-func.ll b/llvm/test/CodeGen/ARM/dso-local-func.ll
index 233249a..ae57bbe 100644
--- a/llvm/test/CodeGen/ARM/dso-local-func.ll
+++ b/llvm/test/CodeGen/ARM/dso-local-func.ll
@@ -10,8 +10,7 @@ define dso_local ptr @dsolocal_func() nounwind {
; CHECK-NEXT: .type dsolocal_func,%function
; CHECK-NEXT: .code 32
; CHECK-NEXT: dsolocal_func:
-; TODO: PIC codegen should emit a $local alias here
-; PIC-TODO-NEXT: .Ldsolocal_func$local:
+; PIC-NEXT: .Ldsolocal_func$local:
; CHECK-NEXT: .fnstart
; CHECK-NEXT: @ %bb.0:
; STATIC-NEXT: movw r0, :lower16:dsolocal_func
diff --git a/llvm/utils/UpdateTestChecks/asm.py b/llvm/utils/UpdateTestChecks/asm.py
index 821b2d0..7e3bfdc 100644
--- a/llvm/utils/UpdateTestChecks/asm.py
+++ b/llvm/utils/UpdateTestChecks/asm.py
@@ -24,6 +24,7 @@ ASM_FUNCTION_X86_RE = re.compile(
ASM_FUNCTION_ARM_RE = re.compile(
r'^(?P<func>[0-9a-zA-Z_$]+):\n' # f: (name of function)
+ r'(?:\.L(?P=func)\$local:\n)?' # drop .L<func>$local:
r'\s+\.fnstart\n' # .fnstart
r'(?P<body>.*?)' # (body of the function)
r'^.Lfunc_end[0-9]+:', # .Lfunc_end0: or # -- End function