Skip to content

Commit 9a2b14a

Browse files
committed
[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
1 parent 7925341 commit 9a2b14a

File tree

3 files changed

+3
-4
lines changed

3 files changed

+3
-4
lines changed

llvm/lib/Target/ARM/ARMAsmPrinter.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,7 @@ void ARMAsmPrinter::emitFunctionEntryLabel() {
8282
OutStreamer->emitSymbolAttribute(S, MCSA_ELF_TypeFunction);
8383
OutStreamer->emitLabel(S);
8484
}
85-
86-
OutStreamer->emitLabel(CurrentFnSym);
85+
AsmPrinter::emitFunctionEntryLabel();
8786
}
8887

8988
void ARMAsmPrinter::emitXXStructor(const DataLayout &DL, const Constant *CV) {

llvm/test/CodeGen/ARM/dso-local-func.ll

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ define dso_local ptr @dsolocal_func() nounwind {
1010
; CHECK-NEXT: .type dsolocal_func,%function
1111
; CHECK-NEXT: .code 32
1212
; CHECK-NEXT: dsolocal_func:
13-
; TODO: PIC codegen should emit a $local alias here
14-
; PIC-TODO-NEXT: .Ldsolocal_func$local:
13+
; PIC-NEXT: .Ldsolocal_func$local:
1514
; CHECK-NEXT: .fnstart
1615
; CHECK-NEXT: @ %bb.0:
1716
; STATIC-NEXT: movw r0, :lower16:dsolocal_func

llvm/utils/UpdateTestChecks/asm.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ class string:
2424

2525
ASM_FUNCTION_ARM_RE = re.compile(
2626
r'^(?P<func>[0-9a-zA-Z_$]+):\n' # f: (name of function)
27+
r'(?:\.L(?P=func)\$local:\n)?' # drop .L<func>$local:
2728
r'\s+\.fnstart\n' # .fnstart
2829
r'(?P<body>.*?)' # (body of the function)
2930
r'^.Lfunc_end[0-9]+:', # .Lfunc_end0: or # -- End function

0 commit comments

Comments
 (0)