[llvm] [CodeGen][ARM64EC] Use MCSymbolRefExpr::VK_None for function aliases. (PR #92100)
Jacek Caban via llvm-commits
llvm-commits at lists.llvm.org
Wed May 15 09:38:04 PDT 2024
https://github.com/cjacek updated https://github.com/llvm/llvm-project/pull/92100
>From 8b99723be0977f2ee941586dc8f0de5ebe980e3e Mon Sep 17 00:00:00 2001
From: Jacek Caban <jacek at codeweavers.com>
Date: Wed, 15 May 2024 11:57:05 +0200
Subject: [PATCH 1/2] [CodeGen][ARM64EC][NFC] Add ARM64EC alias symbols test.
---
llvm/test/CodeGen/AArch64/arm64ec-symbols.ll | 27 ++++++++++++++++++++
1 file changed, 27 insertions(+)
create mode 100644 llvm/test/CodeGen/AArch64/arm64ec-symbols.ll
diff --git a/llvm/test/CodeGen/AArch64/arm64ec-symbols.ll b/llvm/test/CodeGen/AArch64/arm64ec-symbols.ll
new file mode 100644
index 0000000000000..389c36974beda
--- /dev/null
+++ b/llvm/test/CodeGen/AArch64/arm64ec-symbols.ll
@@ -0,0 +1,27 @@
+; RUN: llc -mtriple=arm64ec-pc-windows-msvc < %s | FileCheck %s
+; RUN: llc -mtriple=arm64ec-pc-windows-msvc -filetype=obj -o %t.o < %s
+; RUN: llvm-objdump -t %t.o | FileCheck --check-prefix=SYM %s
+
+declare void @func() nounwind;
+
+define void @caller() nounwind {
+ call void @func()
+ ret void
+}
+
+; CHECK: .weak_anti_dep caller
+; CHECK-NEXT: .set caller, "#caller"@WEAKREF
+
+; CHECK: .weak_anti_dep func
+; CHECK-NEXT: .set func, "#func"@WEAKREF
+; CHECK-NEXT: .weak_anti_dep "#func"
+; CHECK-NEXT: .set "#func", "#func$exit_thunk"@WEAKREF
+
+; SYM: [ 8](sec 4)(fl 0x00)(ty 20)(scl 2) (nx 0) 0x00000000 #caller
+; SYM: [21](sec 7)(fl 0x00)(ty 20)(scl 2) (nx 0) 0x00000000 #func$exit_thunk
+; SYM: [33](sec 0)(fl 0x00)(ty 0)(scl 69) (nx 1) 0x00000000 caller
+; SYM-NEXT: AUX indx 8 srch 4
+; SYM-NEXT: [35](sec 0)(fl 0x00)(ty 0)(scl 69) (nx 1) 0x00000000 #func
+; SYM-NEXT: AUX indx 21 srch 4
+; SYM: [39](sec 0)(fl 0x00)(ty 0)(scl 69) (nx 1) 0x00000000 func
+; SYM-NEXT: AUX indx 35 srch 4
>From 3e392836e7253d067ff1c27eeb4ec8ce74a8de86 Mon Sep 17 00:00:00 2001
From: Jacek Caban <jacek at codeweavers.com>
Date: Wed, 15 May 2024 12:56:40 +0200
Subject: [PATCH 2/2] [CodeGen][ARM64EC] Use MCSymbolRefExpr::VK_None for
function aliases.
---
llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp | 2 +-
llvm/test/CodeGen/AArch64/arm64ec-symbols.ll | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp b/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
index 3ce766fc173c8..bdc3fc630a4e3 100644
--- a/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
+++ b/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
@@ -1170,7 +1170,7 @@ void AArch64AsmPrinter::emitFunctionEntryLabel() {
auto emitFunctionAlias = [&](MCSymbol *Src, MCSymbol *Dst) {
OutStreamer->emitSymbolAttribute(Src, MCSA_WeakAntiDep);
OutStreamer->emitAssignment(
- Src, MCSymbolRefExpr::create(Dst, MCSymbolRefExpr::VK_WEAKREF,
+ Src, MCSymbolRefExpr::create(Dst, MCSymbolRefExpr::VK_None,
MMI->getContext()));
};
diff --git a/llvm/test/CodeGen/AArch64/arm64ec-symbols.ll b/llvm/test/CodeGen/AArch64/arm64ec-symbols.ll
index 389c36974beda..b79dd7d61dd60 100644
--- a/llvm/test/CodeGen/AArch64/arm64ec-symbols.ll
+++ b/llvm/test/CodeGen/AArch64/arm64ec-symbols.ll
@@ -10,12 +10,12 @@ define void @caller() nounwind {
}
; CHECK: .weak_anti_dep caller
-; CHECK-NEXT: .set caller, "#caller"@WEAKREF
+; CHECK-NEXT: .set caller, "#caller"{{$}}
; CHECK: .weak_anti_dep func
-; CHECK-NEXT: .set func, "#func"@WEAKREF
+; CHECK-NEXT: .set func, "#func"{{$}}
; CHECK-NEXT: .weak_anti_dep "#func"
-; CHECK-NEXT: .set "#func", "#func$exit_thunk"@WEAKREF
+; CHECK-NEXT: .set "#func", "#func$exit_thunk"{{$}}
; SYM: [ 8](sec 4)(fl 0x00)(ty 20)(scl 2) (nx 0) 0x00000000 #caller
; SYM: [21](sec 7)(fl 0x00)(ty 20)(scl 2) (nx 0) 0x00000000 #func$exit_thunk
More information about the llvm-commits
mailing list