Skip to content

Commit ca502db

Browse files
committed
[testsuite][cleanup] Remove all usages of dont_merge hack to avoid function merging
Resolves #129438 The `-Zmerge-functions=disabled` compile flag exists for this purpose.
1 parent c8b14ba commit ca502db

12 files changed

+0
-126
lines changed

tests/assembly/asm/aarch64-modifiers.rs

-6
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,6 @@ macro_rules! check {
2929
// -O and extern "C" guarantee that the selected register is always r0/s0/d0/q0
3030
#[no_mangle]
3131
pub unsafe extern "C" fn $func() -> i32 {
32-
// Hack to avoid function merging
33-
extern "Rust" {
34-
fn dont_merge(s: &str);
35-
}
36-
dont_merge(stringify!($func));
37-
3832
let y;
3933
asm!($code, out($reg) y);
4034
y

tests/assembly/asm/aarch64-types.rs

-12
Original file line numberDiff line numberDiff line change
@@ -113,12 +113,6 @@ macro_rules! check {
113113
($func:ident $ty:ident $class:ident $mov:literal $modifier:literal) => {
114114
#[no_mangle]
115115
pub unsafe fn $func(x: $ty) -> $ty {
116-
// Hack to avoid function merging
117-
extern "Rust" {
118-
fn dont_merge(s: &str);
119-
}
120-
dont_merge(stringify!($func));
121-
122116
let y;
123117
asm!(
124118
concat!($mov, " {:", $modifier, "}, {:", $modifier, "}"),
@@ -134,12 +128,6 @@ macro_rules! check_reg {
134128
($func:ident $ty:ident $reg:tt $mov:literal) => {
135129
#[no_mangle]
136130
pub unsafe fn $func(x: $ty) -> $ty {
137-
// Hack to avoid function merging
138-
extern "Rust" {
139-
fn dont_merge(s: &str);
140-
}
141-
dont_merge(stringify!($func));
142-
143131
let y;
144132
asm!(concat!($mov, " ", $reg, ", ", $reg), lateout($reg) y, in($reg) x);
145133
y

tests/assembly/asm/arm-modifiers.rs

-6
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,6 @@ macro_rules! check {
4040
// -O and extern "C" guarantee that the selected register is always r0/s0/d0/q0
4141
#[no_mangle]
4242
pub unsafe extern "C" fn $func() -> $ty {
43-
// Hack to avoid function merging
44-
extern "Rust" {
45-
fn dont_merge(s: &str);
46-
}
47-
dont_merge(stringify!($func));
48-
4943
let y;
5044
asm!(concat!($mov, " {0:", $modifier, "}, {0:", $modifier, "}"), out($reg) y);
5145
y

tests/assembly/asm/arm-types.rs

-12
Original file line numberDiff line numberDiff line change
@@ -114,12 +114,6 @@ macro_rules! check {
114114
($func:ident $ty:ident $class:ident $mov:literal) => {
115115
#[no_mangle]
116116
pub unsafe fn $func(x: $ty) -> $ty {
117-
// Hack to avoid function merging
118-
extern "Rust" {
119-
fn dont_merge(s: &str);
120-
}
121-
dont_merge(stringify!($func));
122-
123117
let y;
124118
asm!(concat!($mov, " {}, {}"), out($class) y, in($class) x);
125119
y
@@ -131,12 +125,6 @@ macro_rules! check_reg {
131125
($func:ident $ty:ident $reg:tt $mov:literal) => {
132126
#[no_mangle]
133127
pub unsafe fn $func(x: $ty) -> $ty {
134-
// Hack to avoid function merging
135-
extern "Rust" {
136-
fn dont_merge(s: &str);
137-
}
138-
dont_merge(stringify!($func));
139-
140128
let y;
141129
asm!(concat!($mov, " ", $reg, ", ", $reg), lateout($reg) y, in($reg) x);
142130
y

tests/assembly/asm/hexagon-types.rs

-24
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,6 @@ macro_rules! check {
4141
($func:ident $ty:ident $class:ident) => {
4242
#[no_mangle]
4343
pub unsafe fn $func(x: $ty) -> $ty {
44-
// Hack to avoid function merging
45-
extern "Rust" {
46-
fn dont_merge(s: &str);
47-
}
48-
dont_merge(stringify!($func));
49-
5044
let y;
5145
asm!("{} = {}", out($class) y, in($class) x);
5246
y
@@ -58,12 +52,6 @@ macro_rules! check_reg {
5852
($func:ident $ty:ident $reg:tt) => {
5953
#[no_mangle]
6054
pub unsafe fn $func(x: $ty) -> $ty {
61-
// Hack to avoid function merging
62-
extern "Rust" {
63-
fn dont_merge(s: &str);
64-
}
65-
dont_merge(stringify!($func));
66-
6755
let y;
6856
asm!(concat!($reg, " = ", $reg), lateout($reg) y, in($reg) x);
6957
y
@@ -77,12 +65,6 @@ macro_rules! check_reg {
7765
// CHECK: InlineAsm End
7866
#[no_mangle]
7967
pub unsafe fn sym_static() {
80-
// Hack to avoid function merging
81-
extern "Rust" {
82-
fn dont_merge(s: &str);
83-
}
84-
dont_merge(stringify!($func));
85-
8668
asm!("r0 = #{}", sym extern_static);
8769
}
8870

@@ -92,12 +74,6 @@ pub unsafe fn sym_static() {
9274
// CHECK: InlineAsm End
9375
#[no_mangle]
9476
pub unsafe fn sym_fn() {
95-
// Hack to avoid function merging
96-
extern "Rust" {
97-
fn dont_merge(s: &str);
98-
}
99-
dont_merge(stringify!($func));
100-
10177
asm!("r0 = #{}", sym extern_func);
10278
}
10379

tests/assembly/asm/loongarch-type.rs

-9
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,6 @@ extern "C" {
3939
static extern_static: u8;
4040
}
4141

42-
// Hack to avoid function merging
43-
extern "Rust" {
44-
fn dont_merge(s: &str);
45-
}
46-
4742
// CHECK-LABEL: sym_fn:
4843
// CHECK: #APP
4944
// CHECK: pcalau12i $t0, %got_pc_hi20(extern_func)
@@ -67,8 +62,6 @@ pub unsafe fn sym_static() {
6762
macro_rules! check { ($func:ident, $ty:ty, $class:ident, $mov:literal) => {
6863
#[no_mangle]
6964
pub unsafe fn $func(x: $ty) -> $ty {
70-
dont_merge(stringify!($func));
71-
7265
let y;
7366
asm!(concat!($mov," {}, {}"), out($class) y, in($class) x);
7467
y
@@ -78,8 +71,6 @@ macro_rules! check { ($func:ident, $ty:ty, $class:ident, $mov:literal) => {
7871
macro_rules! check_reg { ($func:ident, $ty:ty, $reg:tt, $mov:literal) => {
7972
#[no_mangle]
8073
pub unsafe fn $func(x: $ty) -> $ty {
81-
dont_merge(stringify!($func));
82-
8374
let y;
8475
asm!(concat!($mov, " ", $reg, ", ", $reg), lateout($reg) y, in($reg) x);
8576
y

tests/assembly/asm/mips-types.rs

-9
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,9 @@ extern "C" {
4343
static extern_static: u8;
4444
}
4545

46-
// Hack to avoid function merging
47-
extern "Rust" {
48-
fn dont_merge(s: &str);
49-
}
50-
5146
macro_rules! check { ($func:ident, $ty:ty, $class:ident, $mov:literal) => {
5247
#[no_mangle]
5348
pub unsafe fn $func(x: $ty) -> $ty {
54-
dont_merge(stringify!($func));
55-
5649
let y;
5750
asm!(concat!($mov," {}, {}"), out($class) y, in($class) x);
5851
y
@@ -62,8 +55,6 @@ macro_rules! check { ($func:ident, $ty:ty, $class:ident, $mov:literal) => {
6255
macro_rules! check_reg { ($func:ident, $ty:ty, $reg:tt, $mov:literal) => {
6356
#[no_mangle]
6457
pub unsafe fn $func(x: $ty) -> $ty {
65-
dont_merge(stringify!($func));
66-
6758
let y;
6859
asm!(concat!($mov, " ", $reg, ", ", $reg), lateout($reg) y, in($reg) x);
6960
y

tests/assembly/asm/powerpc-types.rs

-9
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,9 @@ extern "C" {
4343
static extern_static: u8;
4444
}
4545

46-
// Hack to avoid function merging
47-
extern "Rust" {
48-
fn dont_merge(s: &str);
49-
}
50-
5146
macro_rules! check { ($func:ident, $ty:ty, $class:ident, $mov:literal) => {
5247
#[no_mangle]
5348
pub unsafe fn $func(x: $ty) -> $ty {
54-
dont_merge(stringify!($func));
55-
5649
let y;
5750
asm!(concat!($mov," {}, {}"), out($class) y, in($class) x);
5851
y
@@ -62,8 +55,6 @@ macro_rules! check { ($func:ident, $ty:ty, $class:ident, $mov:literal) => {
6255
macro_rules! check_reg { ($func:ident, $ty:ty, $rego:tt, $regc:tt, $mov:literal) => {
6356
#[no_mangle]
6457
pub unsafe fn $func(x: $ty) -> $ty {
65-
dont_merge(stringify!($func));
66-
6758
let y;
6859
asm!(concat!($mov, " ", $rego, ", ", $rego), lateout($regc) y, in($regc) x);
6960
y

tests/assembly/asm/riscv-types.rs

-12
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,6 @@ macro_rules! check {
9090
($func:ident $ty:ident $class:ident $mov:literal) => {
9191
#[no_mangle]
9292
pub unsafe fn $func(x: $ty) -> $ty {
93-
// Hack to avoid function merging
94-
extern "Rust" {
95-
fn dont_merge(s: &str);
96-
}
97-
dont_merge(stringify!($func));
98-
9993
let y;
10094
asm!(concat!($mov, " {}, {}"), out($class) y, in($class) x);
10195
y
@@ -107,12 +101,6 @@ macro_rules! check_reg {
107101
($func:ident $ty:ident $reg:tt $mov:literal) => {
108102
#[no_mangle]
109103
pub unsafe fn $func(x: $ty) -> $ty {
110-
// Hack to avoid function merging
111-
extern "Rust" {
112-
fn dont_merge(s: &str);
113-
}
114-
dont_merge(stringify!($func));
115-
116104
let y;
117105
asm!(concat!($mov, " ", $reg, ", ", $reg), lateout($reg) y, in($reg) x);
118106
y

tests/assembly/asm/s390x-types.rs

-9
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,9 @@ extern "C" {
4242
static extern_static: u8;
4343
}
4444

45-
// Hack to avoid function merging
46-
extern "Rust" {
47-
fn dont_merge(s: &str);
48-
}
49-
5045
macro_rules! check { ($func:ident, $ty:ty, $class:ident, $mov:literal) => {
5146
#[no_mangle]
5247
pub unsafe fn $func(x: $ty) -> $ty {
53-
dont_merge(stringify!($func));
54-
5548
let y;
5649
asm!(concat!($mov," {}, {}"), out($class) y, in($class) x);
5750
y
@@ -61,8 +54,6 @@ macro_rules! check { ($func:ident, $ty:ty, $class:ident, $mov:literal) => {
6154
macro_rules! check_reg { ($func:ident, $ty:ty, $reg:tt, $mov:literal) => {
6255
#[no_mangle]
6356
pub unsafe fn $func(x: $ty) -> $ty {
64-
dont_merge(stringify!($func));
65-
6657
let y;
6758
asm!(concat!($mov, " %", $reg, ", %", $reg), lateout($reg) y, in($reg) x);
6859
y

tests/assembly/asm/x86-modifiers.rs

-6
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,6 @@ macro_rules! check {
3838
// -O and extern "C" guarantee that the selected register is always ax/xmm0
3939
#[no_mangle]
4040
pub unsafe extern "C" fn $func() -> i32 {
41-
// Hack to avoid function merging
42-
extern "Rust" {
43-
fn dont_merge(s: &str);
44-
}
45-
dont_merge(stringify!($func));
46-
4741
let y;
4842
asm!(concat!($mov, " {0:", $modifier, "}, {0:", $modifier, "}"), out($reg) y);
4943
y

tests/assembly/asm/x86-types.rs

-12
Original file line numberDiff line numberDiff line change
@@ -283,12 +283,6 @@ macro_rules! check {
283283
($func:ident $ty:ident $class:ident $mov:literal) => {
284284
#[no_mangle]
285285
pub unsafe fn $func(x: $ty) -> $ty {
286-
// Hack to avoid function merging
287-
extern "Rust" {
288-
fn dont_merge(s: &str);
289-
}
290-
dont_merge(stringify!($func));
291-
292286
let y;
293287
asm!(concat!($mov, " {}, {}"), lateout($class) y, in($class) x);
294288
y
@@ -300,12 +294,6 @@ macro_rules! check_reg {
300294
($func:ident $ty:ident $reg:tt $mov:literal) => {
301295
#[no_mangle]
302296
pub unsafe fn $func(x: $ty) -> $ty {
303-
// Hack to avoid function merging
304-
extern "Rust" {
305-
fn dont_merge(s: &str);
306-
}
307-
dont_merge(stringify!($func));
308-
309297
let y;
310298
asm!(concat!($mov, " ", $reg, ", ", $reg), lateout($reg) y, in($reg) x);
311299
y

0 commit comments

Comments
 (0)