diff --git a/compiler/rustc_codegen_llvm/src/declare.rs b/compiler/rustc_codegen_llvm/src/declare.rs index 419d38f95e595..9c1dba55af799 100644 --- a/compiler/rustc_codegen_llvm/src/declare.rs +++ b/compiler/rustc_codegen_llvm/src/declare.rs @@ -178,13 +178,11 @@ impl<'ll, 'tcx> CodegenCx<'ll, 'tcx> { ) -> &'ll Value { debug!("declare_rust_fn(name={:?}, fn_abi={:?})", name, fn_abi); - // Function addresses in Rust are never significant, allowing functions to - // be merged. let llfn = declare_raw_fn( self, name, fn_abi.llvm_cconv(self), - llvm::UnnamedAddr::Global, + llvm::UnnamedAddr::No, llvm::Visibility::Default, fn_abi.llvm_type(self), ); diff --git a/compiler/rustc_codegen_llvm/src/intrinsic.rs b/compiler/rustc_codegen_llvm/src/intrinsic.rs index 58957b46964c7..665ed3262b819 100644 --- a/compiler/rustc_codegen_llvm/src/intrinsic.rs +++ b/compiler/rustc_codegen_llvm/src/intrinsic.rs @@ -1284,12 +1284,11 @@ fn intrinsic_fn<'ll, 'tcx>( return llfn; } - // Function addresses in Rust are never significant, allowing functions to be merged. let llfn = declare_raw_fn( bx, name, llvm::CCallConv, - llvm::UnnamedAddr::Global, + llvm::UnnamedAddr::No, llvm::Visibility::Default, rust_fn_ty, ); diff --git a/tests/codegen-llvm/backchain.rs b/tests/codegen-llvm/backchain.rs index fae494dcad1b4..b0e7d61c5c24e 100644 --- a/tests/codegen-llvm/backchain.rs +++ b/tests/codegen-llvm/backchain.rs @@ -10,6 +10,6 @@ use minicore::*; #[no_mangle] pub fn test_backchain() { - // CHECK: @test_backchain() unnamed_addr #0 + // CHECK: @test_backchain() local_unnamed_addr #0 } // CHECK: attributes #0 = { {{.*}}"target-features"="{{[^"]*}}+backchain{{.*}} } diff --git a/tests/codegen-llvm/box-uninit-bytes.rs b/tests/codegen-llvm/box-uninit-bytes.rs index fc47e42d6f9db..684f163a82436 100644 --- a/tests/codegen-llvm/box-uninit-bytes.rs +++ b/tests/codegen-llvm/box-uninit-bytes.rs @@ -41,6 +41,6 @@ pub fn box_lotsa_padding() -> Box { // Hide the `allocalign` attribute in the declaration of __rust_alloc // from the CHECK-NOT above, and also verify the attributes got set reasonably. -// CHECK: declare {{(dso_local )?}}noalias noundef ptr @{{.*}}__rust_alloc(i{{[0-9]+}} noundef, i{{[0-9]+}} allocalign noundef range(i{{[0-9]+}} 1, {{-2147483647|-9223372036854775807}})) unnamed_addr [[RUST_ALLOC_ATTRS:#[0-9]+]] +// CHECK: declare {{(dso_local )?}}noalias noundef ptr @{{.*}}__rust_alloc(i{{[0-9]+}} noundef, i{{[0-9]+}} allocalign noundef range(i{{[0-9]+}} 1, {{-2147483647|-9223372036854775807}})) local_unnamed_addr [[RUST_ALLOC_ATTRS:#[0-9]+]] // CHECK-DAG: attributes [[RUST_ALLOC_ATTRS]] = { {{.*}} allockind("alloc,uninitialized,aligned"){{.*}} allocsize(0) {{(uwtable )?}}{{.*}}"alloc-family"="__rust_alloc" {{.*}} } diff --git a/tests/codegen-llvm/bpf-alu32.rs b/tests/codegen-llvm/bpf-alu32.rs index 7fef7e4101eed..317063b1ec13a 100644 --- a/tests/codegen-llvm/bpf-alu32.rs +++ b/tests/codegen-llvm/bpf-alu32.rs @@ -11,7 +11,7 @@ use minicore::*; #[no_mangle] #[target_feature(enable = "alu32")] -// CHECK: define {{.*}}i8 @foo(i8 {{.*}}%arg) unnamed_addr #0 +// CHECK: define {{.*}}i8 @foo(i8 {{.*}}%arg) #0 // CHECK: attributes #0 = { {{.*}}"target-features"="{{[^"]*}}+alu32{{.*}} } pub unsafe fn foo(arg: u8) -> u8 { arg diff --git a/tests/codegen-llvm/fixed-x18.rs b/tests/codegen-llvm/fixed-x18.rs index 2020c2ea18305..b70329f014e72 100644 --- a/tests/codegen-llvm/fixed-x18.rs +++ b/tests/codegen-llvm/fixed-x18.rs @@ -16,7 +16,7 @@ use minicore::*; #[no_mangle] pub fn foo() { - // CHECK: @foo() unnamed_addr #0 + // CHECK: @foo() local_unnamed_addr #0 // unset-NOT: attributes #0 = { {{.*}}"target-features"="{{[^"]*}}+reserve-x18{{.*}} } // set: attributes #0 = { {{.*}}"target-features"="{{[^"]*}}+reserve-x18{{.*}} } diff --git a/tests/codegen-llvm/function-return.rs b/tests/codegen-llvm/function-return.rs index 23547febf7a51..274be3fb703fa 100644 --- a/tests/codegen-llvm/function-return.rs +++ b/tests/codegen-llvm/function-return.rs @@ -19,7 +19,7 @@ use minicore::*; #[no_mangle] pub fn foo() { - // CHECK: @foo() unnamed_addr #0 + // CHECK: @foo() // unset-NOT: fn_ret_thunk_extern // keep-NOT: fn_ret_thunk_extern diff --git a/tests/codegen-llvm/gpu-convergent.rs b/tests/codegen-llvm/gpu-convergent.rs index 376d65a3d4a25..b03d65ad3f69c 100644 --- a/tests/codegen-llvm/gpu-convergent.rs +++ b/tests/codegen-llvm/gpu-convergent.rs @@ -17,8 +17,8 @@ extern "C" { fn ext(); } -// CHECK: define {{.*}}_kernel void @fun(i32{{.*}}) unnamed_addr #[[ATTR:[0-9]+]] -// CHECK: declare void @ext() unnamed_addr #[[ATTR]] +// CHECK: define {{.*}}_kernel void @fun(i32{{.*}}) local_unnamed_addr #[[ATTR:[0-9]+]] +// CHECK: declare void @ext() local_unnamed_addr #[[ATTR]] // CHECK: attributes #[[ATTR]] = {{.*}} convergent #[no_mangle] pub extern "gpu-kernel" fn fun(_: i32) { diff --git a/tests/codegen-llvm/instrument-coverage/testprog.rs b/tests/codegen-llvm/instrument-coverage/testprog.rs index 67c49c438f9f7..10c0e2be0e1bc 100644 --- a/tests/codegen-llvm/instrument-coverage/testprog.rs +++ b/tests/codegen-llvm/instrument-coverage/testprog.rs @@ -101,7 +101,7 @@ fn main() { // CHECK-SAME: @__llvm_prf_nm // CHECK-SAME: section "llvm.metadata" -// CHECK: define internal { {{.*}} } @_R{{[a-zA-Z0-9_]+}}testprog14will_be_called() unnamed_addr #{{[0-9]+}} +// CHECK: define internal { {{.*}} } @_R{{[a-zA-Z0-9_]+}}testprog14will_be_called() #{{[0-9]+}} // CHECK-NEXT: start: // CHECK-NOT: define internal // CHECK: atomicrmw add ptr diff --git a/tests/codegen-llvm/instrument_fn.rs b/tests/codegen-llvm/instrument_fn.rs index 00336d3e7b983..a916ae1238979 100644 --- a/tests/codegen-llvm/instrument_fn.rs +++ b/tests/codegen-llvm/instrument_fn.rs @@ -19,19 +19,19 @@ extern crate minicore; use minicore::*; #[no_mangle] -// CHECK: define {{.*}}void @instrument_default() {{.*}} [[DFLT_ATTR:#[0-9]+]] +// CHECK: define {{.*}}void @instrument_default() [[DFLT_ATTR:#[0-9]+]] fn instrument_default() {} #[no_mangle] #[instrument_fn = "off"] -// CHECK: define {{.*}}void @instrument_off() {{.*}} [[OFF_ATTR:#[0-9]+]] +// CHECK: define {{.*}}void @instrument_off() [[OFF_ATTR:#[0-9]+]] fn instrument_off() {} #[no_mangle] #[instrument_fn = "on"] -// MCOUNT: define {{.*}}void @instrument_on() {{.*}} [[DFLT_ATTR]] -// FENTRY: define void @instrument_on() {{.*}} [[DFLT_ATTR]] -// XRAY: define void @instrument_on() {{.*}} [[ON_ATTR:#[0-9]+]] +// MCOUNT: define {{.*}}void @instrument_on() [[DFLT_ATTR]] +// FENTRY: define void @instrument_on() [[DFLT_ATTR]] +// XRAY: define void @instrument_on() [[ON_ATTR:#[0-9]+]] fn instrument_on() {} // MCOUNT: attributes [[DFLT_ATTR]] {{.*}} "instrument-function-entry-inlined"= diff --git a/tests/codegen-llvm/maybe_dangling_refs.rs b/tests/codegen-llvm/maybe_dangling_refs.rs index 07493ecac79c5..93151e0a55b20 100644 --- a/tests/codegen-llvm/maybe_dangling_refs.rs +++ b/tests/codegen-llvm/maybe_dangling_refs.rs @@ -9,37 +9,37 @@ use std::mem::MaybeDangling; -// CHECK: define {{(dso_local )?}}noundef nonnull ptr @f(ptr noundef nonnull %x) unnamed_addr +// CHECK: define {{(dso_local )?}}noundef nonnull ptr @f(ptr noundef nonnull %x) #[no_mangle] pub fn f(x: MaybeDangling>) -> MaybeDangling> { x } -// CHECK: define {{(dso_local )?}}noundef nonnull ptr @g(ptr noundef nonnull %x) unnamed_addr +// CHECK: define {{(dso_local )?}}noundef nonnull ptr @g(ptr noundef nonnull %x) #[no_mangle] pub fn g(x: MaybeDangling<&u8>) -> MaybeDangling<&u8> { x } -// CHECK: define {{(dso_local )?}}noundef nonnull ptr @h(ptr noundef nonnull %x) unnamed_addr +// CHECK: define {{(dso_local )?}}noundef nonnull ptr @h(ptr noundef nonnull %x) #[no_mangle] pub fn h(x: MaybeDangling<&mut u8>) -> MaybeDangling<&mut u8> { x } -// CHECK: define {{(dso_local )?}}noundef nonnull align 4 ptr @i(ptr noundef nonnull align 4 %x) unnamed_addr +// CHECK: define {{(dso_local )?}}noundef nonnull align 4 ptr @i(ptr noundef nonnull align 4 %x) #[no_mangle] pub fn i(x: MaybeDangling>) -> MaybeDangling> { x } -// CHECK: define {{(dso_local )?}}noundef nonnull align 4 ptr @j(ptr noundef nonnull align 4 %x) unnamed_addr +// CHECK: define {{(dso_local )?}}noundef nonnull align 4 ptr @j(ptr noundef nonnull align 4 %x) #[no_mangle] pub fn j(x: MaybeDangling<&u32>) -> MaybeDangling<&u32> { x } -// CHECK: define {{(dso_local )?}}noundef nonnull align 4 ptr @k(ptr noundef nonnull align 4 %x) unnamed_addr +// CHECK: define {{(dso_local )?}}noundef nonnull align 4 ptr @k(ptr noundef nonnull align 4 %x) #[no_mangle] pub fn k(x: MaybeDangling<&mut u32>) -> MaybeDangling<&mut u32> { x diff --git a/tests/codegen-llvm/merge-functions.rs b/tests/codegen-llvm/merge-functions.rs deleted file mode 100644 index b9d3727ce112e..0000000000000 --- a/tests/codegen-llvm/merge-functions.rs +++ /dev/null @@ -1,16 +0,0 @@ -//@ revisions: O Os -//@[Os] compile-flags: -Copt-level=s -//@[O] compile-flags: -Copt-level=3 -#![crate_type = "lib"] - -// CHECK: @func{{2|1}} = {{.*}}alias{{.*}}@func{{1|2}} - -#[no_mangle] -pub fn func1(c: char) -> bool { - c == 's' || c == 'm' || c == 'h' || c == 'd' || c == 'w' -} - -#[no_mangle] -pub fn func2(c: char) -> bool { - matches!(c, 's' | 'm' | 'h' | 'd' | 'w') -} diff --git a/tests/codegen-llvm/no-jump-tables.rs b/tests/codegen-llvm/no-jump-tables.rs index ff79c43dfc9c6..60f818076313e 100644 --- a/tests/codegen-llvm/no-jump-tables.rs +++ b/tests/codegen-llvm/no-jump-tables.rs @@ -17,7 +17,7 @@ use minicore::*; #[no_mangle] pub fn foo() { - // CHECK: @foo() unnamed_addr #0 + // CHECK: @foo() local_unnamed_addr #0 // unset-NOT: attributes #0 = { {{.*}}"no-jump-tables"="true"{{.*}} } // set_yes-NOT: attributes #0 = { {{.*}}"no-jump-tables"="true"{{.*}} } diff --git a/tests/codegen-llvm/noreturn-uninhabited.rs b/tests/codegen-llvm/noreturn-uninhabited.rs index a10795d3f3c00..1ab98ca418f60 100644 --- a/tests/codegen-llvm/noreturn-uninhabited.rs +++ b/tests/codegen-llvm/noreturn-uninhabited.rs @@ -7,7 +7,7 @@ pub enum EmptyEnum {} #[no_mangle] pub fn empty(x: &EmptyEnum) -> EmptyEnum { - // CHECK: @empty({{.*}}) unnamed_addr #0 + // CHECK: @empty({{.*}}) #0 // CHECK-NOT: ret void // CHECK: call void @llvm.trap() // CHECK: unreachable @@ -18,7 +18,7 @@ pub struct Foo(String, EmptyEnum); #[no_mangle] pub fn foo(x: String, y: &EmptyEnum) -> Foo { - // CHECK: @foo({{.*}}) unnamed_addr #0 + // CHECK: @foo({{.*}}) #0 // CHECK-NOT: ret %Foo // CHECK: call void @llvm.trap() // CHECK: unreachable diff --git a/tests/codegen-llvm/noreturnflag.rs b/tests/codegen-llvm/noreturnflag.rs index d9bb30b2703a7..b6f5671bbc961 100644 --- a/tests/codegen-llvm/noreturnflag.rs +++ b/tests/codegen-llvm/noreturnflag.rs @@ -4,7 +4,7 @@ #[no_mangle] pub fn foo() -> ! { - // CHECK: @foo() unnamed_addr #0 + // CHECK: @foo() #0 loop {} } @@ -12,7 +12,7 @@ pub enum EmptyEnum {} #[no_mangle] pub fn bar() -> EmptyEnum { - // CHECK: @bar() unnamed_addr #0 + // CHECK: @bar() #0 loop {} } diff --git a/tests/codegen-llvm/nounwind.rs b/tests/codegen-llvm/nounwind.rs index c910644458aa2..6a3cb7e5663a9 100644 --- a/tests/codegen-llvm/nounwind.rs +++ b/tests/codegen-llvm/nounwind.rs @@ -9,7 +9,7 @@ extern crate nounwind; #[no_mangle] pub fn foo() { nounwind::bar(); - // CHECK: @foo() unnamed_addr #0 - // CHECK: @bar() unnamed_addr #0 + // CHECK: @foo() #0 + // CHECK: @bar() #0 // CHECK: attributes #0 = { {{.*}}nounwind{{.*}} } } diff --git a/tests/codegen-llvm/packedstack.rs b/tests/codegen-llvm/packedstack.rs index 11a01e60f8d40..1709eb3da0226 100644 --- a/tests/codegen-llvm/packedstack.rs +++ b/tests/codegen-llvm/packedstack.rs @@ -12,7 +12,7 @@ use minicore::*; #[no_mangle] pub fn test_packedstack() { - // CHECK: @test_packedstack() unnamed_addr #0 + // CHECK: @test_packedstack() local_unnamed_addr #0 } // CHECK: attributes #0 = { {{.*}}"packed-stack"{{.*}} } diff --git a/tests/codegen-llvm/patchable-function-entry/patchable-function-entry-both-flags.rs b/tests/codegen-llvm/patchable-function-entry/patchable-function-entry-both-flags.rs index 45aa46d24fe94..98da117cc6e52 100644 --- a/tests/codegen-llvm/patchable-function-entry/patchable-function-entry-both-flags.rs +++ b/tests/codegen-llvm/patchable-function-entry/patchable-function-entry-both-flags.rs @@ -59,16 +59,16 @@ pub fn fun8() {} #[patchable_function_entry(entry_nops = 5, section = "baz")] pub fn fun9() {} -// CHECK: @fun0() unnamed_addr #0 -// CHECK: @fun1() unnamed_addr #1 -// CHECK: @fun2() unnamed_addr #2 -// CHECK: @fun3() unnamed_addr #3 -// CHECK: @fun4() unnamed_addr #4 -// CHECK: @fun5() unnamed_addr #5 -// CHECK: @fun6() unnamed_addr #6 -// CHECK: @fun7() unnamed_addr #7 -// CHECK: @fun8() unnamed_addr #8 -// CHECK: @fun9() unnamed_addr #9 +// CHECK: @fun0(){{.*}} #0 +// CHECK: @fun1(){{.*}} #1 +// CHECK: @fun2(){{.*}} #2 +// CHECK: @fun3(){{.*}} #3 +// CHECK: @fun4(){{.*}} #4 +// CHECK: @fun5(){{.*}} #5 +// CHECK: @fun6(){{.*}} #6 +// CHECK: @fun7(){{.*}} #7 +// CHECK: @fun8(){{.*}} #8 +// CHECK: @fun9(){{.*}} #9 // CHECK: attributes #0 = { {{.*}}"patchable-function-entry"="5"{{.*}}"patchable-function-prefix"="10" {{.*}} } // CHECK: attributes #1 = { {{.*}}"patchable-function-entry"="2"{{.*}}"patchable-function-prefix"="1" {{.*}} } diff --git a/tests/codegen-llvm/patchable-function-entry/patchable-function-entry-no-flag.rs b/tests/codegen-llvm/patchable-function-entry/patchable-function-entry-no-flag.rs index 3a7078fe55107..5d40b6cc204e8 100644 --- a/tests/codegen-llvm/patchable-function-entry/patchable-function-entry-no-flag.rs +++ b/tests/codegen-llvm/patchable-function-entry/patchable-function-entry-no-flag.rs @@ -22,10 +22,10 @@ pub fn fun2() {} #[patchable_function_entry(prefix_nops = 4)] pub fn fun3() {} -// CHECK: @fun0() unnamed_addr #0 -// CHECK: @fun1() unnamed_addr #1 -// CHECK: @fun2() unnamed_addr #2 -// CHECK: @fun3() unnamed_addr #3 +// CHECK: @fun0(){{.*}} #0 +// CHECK: @fun1(){{.*}} #1 +// CHECK: @fun2(){{.*}} #2 +// CHECK: @fun3(){{.*}} #3 // CHECK-NOT: attributes #0 = { {{.*}}patchable-function-entry{{.*}} } // CHECK-NOT: attributes #0 = { {{.*}}patchable-function-prefix{{.*}} } diff --git a/tests/codegen-llvm/patchable-function-entry/patchable-function-entry-one-flag.rs b/tests/codegen-llvm/patchable-function-entry/patchable-function-entry-one-flag.rs index 8bdd61e461b81..c32bedd5e1122 100644 --- a/tests/codegen-llvm/patchable-function-entry/patchable-function-entry-one-flag.rs +++ b/tests/codegen-llvm/patchable-function-entry/patchable-function-entry-one-flag.rs @@ -39,13 +39,13 @@ pub fn fun5() {} #[patchable_function_entry(prefix_nops = 4)] pub fn fun6() {} -// CHECK: @fun0() unnamed_addr #0 -// CHECK: @fun1() unnamed_addr #1 -// CHECK: @fun2() unnamed_addr #2 -// CHECK: @fun3() unnamed_addr #3 -// CHECK: @fun4() unnamed_addr #4 -// CHECK: @fun5() unnamed_addr #5 -// CHECK: @fun6() unnamed_addr #6 +// CHECK: @fun0(){{.*}} #0 +// CHECK: @fun1(){{.*}} #1 +// CHECK: @fun2(){{.*}} #2 +// CHECK: @fun3(){{.*}} #3 +// CHECK: @fun4(){{.*}} #4 +// CHECK: @fun5(){{.*}} #5 +// CHECK: @fun6(){{.*}} #6 // CHECK: attributes #0 = { {{.*}}"patchable-function-entry"="15" {{.*}} } // CHECK-NOT: attributes #0 = { {{.*}}patchable-function-prefix{{.*}} } diff --git a/tests/codegen-llvm/patchable-function-entry/patchable-function-entry-section.rs b/tests/codegen-llvm/patchable-function-entry/patchable-function-entry-section.rs index 9ffff5ca7537c..861f0eecaba13 100644 --- a/tests/codegen-llvm/patchable-function-entry/patchable-function-entry-section.rs +++ b/tests/codegen-llvm/patchable-function-entry/patchable-function-entry-section.rs @@ -13,8 +13,8 @@ pub fn fun0() {} #[patchable_function_entry(section = "bar_section")] pub fn fun1() {} -// CHECK: @fun0() unnamed_addr #0 -// CHECK: @fun1() unnamed_addr #1 +// CHECK: @fun0(){{.*}} #0 +// CHECK: @fun1(){{.*}} #1 // CHECK: attributes #0 = { {{.*}}"patchable-function-entry"="5"{{.*}}"patchable-function-entry-section"="default_foo_section"{{.*}}"patchable-function-prefix"="10" {{.*}} } // CHECK: attributes #1 = { {{.*}}"patchable-function-entry"="5"{{.*}}"patchable-function-entry-section"="bar_section"{{.*}}"patchable-function-prefix"="10" {{.*}} } diff --git a/tests/codegen-llvm/range-iter-loop-opts.rs b/tests/codegen-llvm/range-iter-loop-opts.rs index c51c7ad42709a..4762b3a946bc8 100644 --- a/tests/codegen-llvm/range-iter-loop-opts.rs +++ b/tests/codegen-llvm/range-iter-loop-opts.rs @@ -8,9 +8,6 @@ use std::num::NonZeroU8; use std::ops::{Range, RangeInclusive}; -// CHECK-LABEL: @rangeinclusive_noop_loop = unnamed_addr alias void (), ptr @range_noop_loop -// CHECK-LABEL: @rangeinclusive_nz_noop_loop = unnamed_addr alias void (), ptr @range_noop_loop - // CHECK-LABEL: @range_noop_loop( #[no_mangle] pub unsafe fn range_noop_loop() { @@ -37,9 +34,12 @@ pub unsafe fn range_count(s: u8, e: u8) -> usize { count } -// Deduplicated to alias of range_noop_loop, checked above +// CHECK-LABEL: @rangeinclusive_noop_loop( #[no_mangle] pub unsafe fn rangeinclusive_noop_loop() { + // CHECK-NEXT: start: + // CHECK-NEXT: ret void + // This loop should be optimized out entirely. for _ in 0_u8..=100 { () @@ -60,9 +60,12 @@ pub unsafe fn rangeinclusive_count(s: u8, e: u8) -> usize { count } -// Deduplicated to alias of range_noop_loop, checked above +// CHECK-LABEL: @rangeinclusive_nz_noop_loop( #[no_mangle] pub unsafe fn rangeinclusive_nz_noop_loop() { + // CHECK-NEXT: start: + // CHECK-NEXT: ret void + // This loop should be optimized out entirely. for _ in NonZeroU8::new(1).unwrap()..=NonZeroU8::new(100).unwrap() { () diff --git a/tests/codegen-llvm/retpoline.rs b/tests/codegen-llvm/retpoline.rs index 89313d02db130..34c19140c9e81 100644 --- a/tests/codegen-llvm/retpoline.rs +++ b/tests/codegen-llvm/retpoline.rs @@ -16,7 +16,7 @@ extern crate minicore; #[no_mangle] pub fn foo() { - // CHECK: @foo() unnamed_addr #0 + // CHECK: @foo(){{.*}} #0 // disabled-NOT: attributes #0 = { {{.*}}"target-features"="{{[^"]*}}+retpoline-external-thunk{{.*}} } // disabled-NOT: attributes #0 = { {{.*}}"target-features"="{{[^"]*}}+retpoline-indirect-branches{{.*}} } diff --git a/tests/codegen-llvm/sanitizer/cfi/external_weak_symbols.rs b/tests/codegen-llvm/sanitizer/cfi/external_weak_symbols.rs index 6ac95aabae877..08879898805fa 100644 --- a/tests/codegen-llvm/sanitizer/cfi/external_weak_symbols.rs +++ b/tests/codegen-llvm/sanitizer/cfi/external_weak_symbols.rs @@ -21,4 +21,4 @@ fn main() { } } -// CHECK: declare !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} extern_weak void @FOO(double) unnamed_addr #{{[0-9]+}} +// CHECK: declare !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} extern_weak void @FOO(double) #{{[0-9]+}} diff --git a/tests/codegen-llvm/sanitizer/riscv64-shadow-call-stack.rs b/tests/codegen-llvm/sanitizer/riscv64-shadow-call-stack.rs index 72f9c12fae0e2..64a52d015f2b5 100644 --- a/tests/codegen-llvm/sanitizer/riscv64-shadow-call-stack.rs +++ b/tests/codegen-llvm/sanitizer/riscv64-shadow-call-stack.rs @@ -11,7 +11,7 @@ extern crate minicore; use minicore::*; // CHECK: ; Function Attrs:{{.*}}shadowcallstack -// CHECK: define dso_local void @foo() unnamed_addr #0 +// CHECK: define dso_local void @foo() local_unnamed_addr #0 #[no_mangle] pub fn foo() {} diff --git a/tests/codegen-llvm/stack-probes-inline.rs b/tests/codegen-llvm/stack-probes-inline.rs index 465e35090ae11..be06b42fab237 100644 --- a/tests/codegen-llvm/stack-probes-inline.rs +++ b/tests/codegen-llvm/stack-probes-inline.rs @@ -28,6 +28,6 @@ use minicore::*; #[no_mangle] pub fn foo() { - // CHECK: @foo() unnamed_addr #0 + // CHECK: @foo() #0 // CHECK: attributes #0 = { {{.*}}"probe-stack"="inline-asm"{{.*}} } } diff --git a/tests/codegen-llvm/stack-protector.rs b/tests/codegen-llvm/stack-protector.rs index 8ab25b470cda1..984e543c90001 100644 --- a/tests/codegen-llvm/stack-protector.rs +++ b/tests/codegen-llvm/stack-protector.rs @@ -8,7 +8,7 @@ #[no_mangle] pub fn foo() { - // CHECK: @foo() unnamed_addr #0 + // CHECK: @foo(){{.*}} #0 // all-NOT: attributes #0 = { {{.*}}sspstrong {{.*}} } // all-NOT: attributes #0 = { {{.*}}ssp {{.*}} } diff --git a/tests/codegen-llvm/target-cpu-on-functions.rs b/tests/codegen-llvm/target-cpu-on-functions.rs index 25c10e7ce4484..2fa45da4d7f21 100644 --- a/tests/codegen-llvm/target-cpu-on-functions.rs +++ b/tests/codegen-llvm/target-cpu-on-functions.rs @@ -7,7 +7,7 @@ #![crate_type = "staticlib"] -// CHECK-LABEL: define {{.*}} @exported() {{.*}} #0 +// CHECK-LABEL: define {{.*}} @exported(){{.*}} #0 #[no_mangle] pub extern "C" fn exported() { not_exported(); @@ -15,7 +15,7 @@ pub extern "C" fn exported() { // CHECK-LABEL: ; target_cpu_on_functions::not_exported // CHECK-NEXT: ; Function Attrs: -// CHECK-NEXT: define {{.*}}() {{.*}} #1 +// CHECK-NEXT: define {{.*}}(){{.*}} #1 #[inline(never)] fn not_exported() {} diff --git a/tests/codegen-llvm/tune-cpu-on-functions.rs b/tests/codegen-llvm/tune-cpu-on-functions.rs index f50245b797fbd..c5aff02e2b045 100644 --- a/tests/codegen-llvm/tune-cpu-on-functions.rs +++ b/tests/codegen-llvm/tune-cpu-on-functions.rs @@ -7,7 +7,7 @@ #![crate_type = "staticlib"] -// CHECK-LABEL: define {{.*}} @exported() {{.*}} #0 +// CHECK-LABEL: define {{.*}} @exported(){{.*}} #0 #[no_mangle] pub extern "C" fn exported() { not_exported(); @@ -15,7 +15,7 @@ pub extern "C" fn exported() { // CHECK-LABEL: ; tune_cpu_on_functions::not_exported // CHECK-NEXT: ; Function Attrs: -// CHECK-NEXT: define {{.*}}() {{.*}} #0 +// CHECK-NEXT: define {{.*}}(){{.*}} #0 fn not_exported() {} // CHECK: attributes #0 = {{.*}} "tune-cpu"="{{.*}}" diff --git a/tests/codegen-llvm/unwind-abis/aapcs-unwind-abi.rs b/tests/codegen-llvm/unwind-abis/aapcs-unwind-abi.rs index 279780e3a7aeb..200747625944d 100644 --- a/tests/codegen-llvm/unwind-abis/aapcs-unwind-abi.rs +++ b/tests/codegen-llvm/unwind-abis/aapcs-unwind-abi.rs @@ -16,11 +16,11 @@ pub trait Sized: MetaSized {} // `aapcs-unwind` extern functions. `aapcs-unwind` functions MUST NOT have this attribute. We // disable optimizations above to prevent LLVM from inferring the attribute. -// CHECK: @rust_item_that_cannot_unwind() unnamed_addr #0 +// CHECK: @rust_item_that_cannot_unwind() #0 #[no_mangle] pub extern "aapcs" fn rust_item_that_cannot_unwind() {} -// CHECK: @rust_item_that_can_unwind() unnamed_addr #1 +// CHECK: @rust_item_that_can_unwind() #1 #[no_mangle] pub extern "aapcs-unwind" fn rust_item_that_can_unwind() {} diff --git a/tests/codegen-llvm/unwind-abis/c-unwind-abi-panic-abort.rs b/tests/codegen-llvm/unwind-abis/c-unwind-abi-panic-abort.rs index 2ce1d1b2e00e6..db9188e4b5f27 100644 --- a/tests/codegen-llvm/unwind-abis/c-unwind-abi-panic-abort.rs +++ b/tests/codegen-llvm/unwind-abis/c-unwind-abi-panic-abort.rs @@ -10,7 +10,7 @@ #![crate_type = "lib"] -// CHECK: @rust_item_that_can_unwind() unnamed_addr [[ATTR0:#[0-9]+]] +// CHECK: @rust_item_that_can_unwind() local_unnamed_addr [[ATTR0:#[0-9]+]] #[no_mangle] pub unsafe extern "C-unwind" fn rust_item_that_can_unwind() { // Handle both legacy and v0 symbol mangling. @@ -21,7 +21,7 @@ pub unsafe extern "C-unwind" fn rust_item_that_can_unwind() { } extern "C-unwind" { - // CHECK: @may_unwind() unnamed_addr [[ATTR1:#[0-9]+]] + // CHECK: @may_unwind() local_unnamed_addr [[ATTR1:#[0-9]+]] fn may_unwind(); } diff --git a/tests/codegen-llvm/unwind-abis/c-unwind-abi.rs b/tests/codegen-llvm/unwind-abis/c-unwind-abi.rs index 1b3312839e3e8..7dcea3c054927 100644 --- a/tests/codegen-llvm/unwind-abis/c-unwind-abi.rs +++ b/tests/codegen-llvm/unwind-abis/c-unwind-abi.rs @@ -7,11 +7,11 @@ #![crate_type = "lib"] -// CHECK: @rust_item_that_cannot_unwind() unnamed_addr #0 +// CHECK: @rust_item_that_cannot_unwind() #0 #[no_mangle] pub extern "C" fn rust_item_that_cannot_unwind() {} -// CHECK: @rust_item_that_can_unwind() unnamed_addr #1 +// CHECK: @rust_item_that_can_unwind() #1 #[no_mangle] pub extern "C-unwind" fn rust_item_that_can_unwind() {} diff --git a/tests/codegen-llvm/unwind-abis/cdecl-unwind-abi.rs b/tests/codegen-llvm/unwind-abis/cdecl-unwind-abi.rs index 6f4eafb353ccb..2ed6e19cd4051 100644 --- a/tests/codegen-llvm/unwind-abis/cdecl-unwind-abi.rs +++ b/tests/codegen-llvm/unwind-abis/cdecl-unwind-abi.rs @@ -7,11 +7,11 @@ #![crate_type = "lib"] -// CHECK: @rust_item_that_cannot_unwind() unnamed_addr #0 +// CHECK: @rust_item_that_cannot_unwind() #0 #[no_mangle] pub extern "cdecl" fn rust_item_that_cannot_unwind() {} -// CHECK: @rust_item_that_can_unwind() unnamed_addr #1 +// CHECK: @rust_item_that_can_unwind() #1 #[no_mangle] pub extern "cdecl-unwind" fn rust_item_that_can_unwind() {} diff --git a/tests/codegen-llvm/unwind-abis/fastcall-unwind-abi.rs b/tests/codegen-llvm/unwind-abis/fastcall-unwind-abi.rs index 51c6fd15b9c5c..56e2519271da9 100644 --- a/tests/codegen-llvm/unwind-abis/fastcall-unwind-abi.rs +++ b/tests/codegen-llvm/unwind-abis/fastcall-unwind-abi.rs @@ -16,11 +16,11 @@ pub trait Sized: MetaSized {} // `fastcall-unwind` extern functions. `fastcall-unwind` functions MUST NOT have this attribute. We // disable optimizations above to prevent LLVM from inferring the attribute. -// CHECK: @rust_item_that_cannot_unwind() unnamed_addr #0 +// CHECK: @rust_item_that_cannot_unwind() #0 #[no_mangle] pub extern "fastcall" fn rust_item_that_cannot_unwind() {} -// CHECK: @rust_item_that_can_unwind() unnamed_addr #1 +// CHECK: @rust_item_that_can_unwind() #1 #[no_mangle] pub extern "fastcall-unwind" fn rust_item_that_can_unwind() {} diff --git a/tests/codegen-llvm/unwind-abis/stdcall-unwind-abi.rs b/tests/codegen-llvm/unwind-abis/stdcall-unwind-abi.rs index b5fcea52b4d61..b6439387ada1e 100644 --- a/tests/codegen-llvm/unwind-abis/stdcall-unwind-abi.rs +++ b/tests/codegen-llvm/unwind-abis/stdcall-unwind-abi.rs @@ -16,11 +16,11 @@ pub trait Sized: MetaSized {} // extern functions. `stdcall-unwind` functions MUST NOT have this attribute. We disable // optimizations above to prevent LLVM from inferring the attribute. -// CHECK: @rust_item_that_cannot_unwind() unnamed_addr #0 +// CHECK: @rust_item_that_cannot_unwind() #0 #[no_mangle] pub extern "stdcall" fn rust_item_that_cannot_unwind() {} -// CHECK: @rust_item_that_can_unwind() unnamed_addr #1 +// CHECK: @rust_item_that_can_unwind() #1 #[no_mangle] pub extern "stdcall-unwind" fn rust_item_that_can_unwind() {} diff --git a/tests/codegen-llvm/unwind-abis/system-unwind-abi.rs b/tests/codegen-llvm/unwind-abis/system-unwind-abi.rs index 15fce95fe285b..177c106ef4ee0 100644 --- a/tests/codegen-llvm/unwind-abis/system-unwind-abi.rs +++ b/tests/codegen-llvm/unwind-abis/system-unwind-abi.rs @@ -7,11 +7,11 @@ #![crate_type = "lib"] -// CHECK: @rust_item_that_cannot_unwind() unnamed_addr #0 +// CHECK: @rust_item_that_cannot_unwind() #0 #[no_mangle] pub extern "system" fn rust_item_that_cannot_unwind() {} -// CHECK: @rust_item_that_can_unwind() unnamed_addr #1 +// CHECK: @rust_item_that_can_unwind() #1 #[no_mangle] pub extern "system-unwind" fn rust_item_that_can_unwind() {} diff --git a/tests/codegen-llvm/unwind-abis/sysv64-unwind-abi.rs b/tests/codegen-llvm/unwind-abis/sysv64-unwind-abi.rs index 1293e7c0a5f82..55d582062cb48 100644 --- a/tests/codegen-llvm/unwind-abis/sysv64-unwind-abi.rs +++ b/tests/codegen-llvm/unwind-abis/sysv64-unwind-abi.rs @@ -16,11 +16,11 @@ pub trait Sized: MetaSized {} // `sysv64-unwind` extern functions. `sysv64-unwind` functions MUST NOT have this attribute. We // disable optimizations above to prevent LLVM from inferring the attribute. -// CHECK: @rust_item_that_cannot_unwind() unnamed_addr #0 +// CHECK: @rust_item_that_cannot_unwind() #0 #[no_mangle] pub extern "sysv64" fn rust_item_that_cannot_unwind() {} -// CHECK: @rust_item_that_can_unwind() unnamed_addr #1 +// CHECK: @rust_item_that_can_unwind() #1 #[no_mangle] pub extern "sysv64-unwind" fn rust_item_that_can_unwind() {} diff --git a/tests/codegen-llvm/unwind-abis/thiscall-unwind-abi.rs b/tests/codegen-llvm/unwind-abis/thiscall-unwind-abi.rs index a9b6c34ee58e2..de7601f655b22 100644 --- a/tests/codegen-llvm/unwind-abis/thiscall-unwind-abi.rs +++ b/tests/codegen-llvm/unwind-abis/thiscall-unwind-abi.rs @@ -16,11 +16,11 @@ pub trait Sized: MetaSized {} // `thiscall-unwind` extern functions. `thiscall-unwind` functions MUST NOT have this attribute. We // disable optimizations above to prevent LLVM from inferring the attribute. -// CHECK: @rust_item_that_cannot_unwind() unnamed_addr #0 +// CHECK: @rust_item_that_cannot_unwind() #0 #[no_mangle] pub extern "thiscall" fn rust_item_that_cannot_unwind() {} -// CHECK: @rust_item_that_can_unwind() unnamed_addr #1 +// CHECK: @rust_item_that_can_unwind() #1 #[no_mangle] pub extern "thiscall-unwind" fn rust_item_that_can_unwind() {} diff --git a/tests/codegen-llvm/unwind-abis/vectorcall-unwind-abi.rs b/tests/codegen-llvm/unwind-abis/vectorcall-unwind-abi.rs index 8cedb55ae1d28..686187e093046 100644 --- a/tests/codegen-llvm/unwind-abis/vectorcall-unwind-abi.rs +++ b/tests/codegen-llvm/unwind-abis/vectorcall-unwind-abi.rs @@ -16,11 +16,11 @@ pub trait Sized: MetaSized {} // `vectorcall-unwind` extern functions. `vectorcall-unwind` functions MUST NOT have this attribute. // We disable optimizations above to prevent LLVM from inferring the attribute. -// CHECK: @rust_item_that_cannot_unwind() unnamed_addr #0 +// CHECK: @rust_item_that_cannot_unwind() #0 #[no_mangle] pub extern "vectorcall" fn rust_item_that_cannot_unwind() {} -// CHECK: @rust_item_that_can_unwind() unnamed_addr #1 +// CHECK: @rust_item_that_can_unwind() #1 #[no_mangle] pub extern "vectorcall-unwind" fn rust_item_that_can_unwind() {} diff --git a/tests/codegen-llvm/unwind-abis/win64-unwind-abi.rs b/tests/codegen-llvm/unwind-abis/win64-unwind-abi.rs index 2a3ad330406e6..09326fb1b48bc 100644 --- a/tests/codegen-llvm/unwind-abis/win64-unwind-abi.rs +++ b/tests/codegen-llvm/unwind-abis/win64-unwind-abi.rs @@ -16,11 +16,11 @@ pub trait Sized: MetaSized {} // `win64-unwind` extern functions. `win64-unwind` functions MUST NOT have this attribute. We // disable optimizations above to prevent LLVM from inferring the attribute. -// CHECK: @rust_item_that_cannot_unwind() unnamed_addr #0 +// CHECK: @rust_item_that_cannot_unwind() #0 #[no_mangle] pub extern "win64" fn rust_item_that_cannot_unwind() {} -// CHECK: @rust_item_that_can_unwind() unnamed_addr #1 +// CHECK: @rust_item_that_can_unwind() #1 #[no_mangle] pub extern "win64-unwind" fn rust_item_that_can_unwind() {} diff --git a/tests/codegen-llvm/vec-calloc.rs b/tests/codegen-llvm/vec-calloc.rs index 0203590174151..354384652282f 100644 --- a/tests/codegen-llvm/vec-calloc.rs +++ b/tests/codegen-llvm/vec-calloc.rs @@ -194,6 +194,6 @@ pub fn vec_array(n: usize) -> Vec<[u32; 1_000_000]> { } // Ensure that __rust_alloc_zeroed gets the right attributes for LLVM to optimize it away. -// CHECK: declare noalias noundef ptr @{{.*}}__rust_alloc_zeroed(i64 noundef, i64 allocalign noundef range(i64 1, -9223372036854775807)) unnamed_addr [[RUST_ALLOC_ZEROED_ATTRS:#[0-9]+]] +// CHECK: declare noalias noundef ptr @{{.*}}__rust_alloc_zeroed(i64 noundef, i64 allocalign noundef range(i64 1, -9223372036854775807)) local_unnamed_addr [[RUST_ALLOC_ZEROED_ATTRS:#[0-9]+]] // CHECK-DAG: attributes [[RUST_ALLOC_ZEROED_ATTRS]] = { {{.*}} allockind("alloc,zeroed,aligned") allocsize(0) {{(uwtable )?}}"alloc-family"="__rust_alloc" {{.*}} }