Skip to content

Commit d7983a2

Browse files
committed
Always name the return place.
1 parent d4096e0 commit d7983a2

25 files changed

+191
-195
lines changed

compiler/rustc_codegen_ssa/src/mir/debuginfo.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -328,8 +328,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
328328

329329
let local_ref = &self.locals[local];
330330

331-
// FIXME Should the return place be named?
332-
let name = if bx.sess().fewer_names() || local == mir::RETURN_PLACE {
331+
let name = if bx.sess().fewer_names() {
333332
None
334333
} else {
335334
Some(match whole_local_var.or(fallback_var.clone()) {

tests/codegen/array-codegen.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
// CHECK-LABEL: @array_load
77
#[no_mangle]
88
pub fn array_load(a: &[u8; 4]) -> [u8; 4] {
9-
// CHECK: %0 = alloca [4 x i8], align 1
9+
// CHECK: %_0 = alloca [4 x i8], align 1
1010
// CHECK: %[[TEMP1:.+]] = load <4 x i8>, ptr %a, align 1
11-
// CHECK: store <4 x i8> %[[TEMP1]], ptr %0, align 1
12-
// CHECK: %[[TEMP2:.+]] = load i32, ptr %0, align 1
11+
// CHECK: store <4 x i8> %[[TEMP1]], ptr %_0, align 1
12+
// CHECK: %[[TEMP2:.+]] = load i32, ptr %_0, align 1
1313
// CHECK: ret i32 %[[TEMP2]]
1414
*a
1515
}

tests/codegen/avr/avr-func-addrspace.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ pub enum Either<T, U> { A(T), B(U) }
116116
// with the `ptr` field representing both `&i32` and `fn()` depending on the variant.
117117
// This is incorrect, because `fn()` should be `ptr addrspace(1)`, not `ptr`.
118118

119-
// CHECK: define{{.+}}void @should_not_combine_addrspace({{.+\*|ptr}}{{.+}}sret{{.+}}%0, {{.+\*|ptr}}{{.+}}%x)
119+
// CHECK: define{{.+}}void @should_not_combine_addrspace({{.+\*|ptr}}{{.+}}sret{{.+}}%_0, {{.+\*|ptr}}{{.+}}%x)
120120
#[no_mangle]
121121
#[inline(never)]
122122
pub fn should_not_combine_addrspace(x: Either<&i32, fn()>) -> Either<&i32, fn()> {

tests/codegen/consts.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// compile-flags: -C no-prepopulate-passes
2+
// min-llvm-version: 15.0 (for opaque pointers)
23

34
#![crate_type = "lib"]
45

@@ -42,14 +43,14 @@ pub fn inline_enum_const() -> E<i8, i16> {
4243
#[no_mangle]
4344
pub fn low_align_const() -> E<i16, [i16; 3]> {
4445
// Check that low_align_const and high_align_const use the same constant
45-
// CHECK: memcpy.{{.+}}({{i8\*|ptr}} align 2 %{{[0-9]+}}, {{i8\*|ptr}} align 2 {{.*}}[[LOW_HIGH]]{{.*}}, i{{(32|64)}} 8, i1 false)
46+
// CHECK: memcpy.{{.+}}(ptr align 2 %_0, ptr align 2 {{.*}}[[LOW_HIGH]]{{.*}}, i{{(32|64)}} 8, i1 false)
4647
*&E::A(0)
4748
}
4849

4950
// CHECK-LABEL: @high_align_const
5051
#[no_mangle]
5152
pub fn high_align_const() -> E<i16, i32> {
5253
// Check that low_align_const and high_align_const use the same constant
53-
// CHECK: memcpy.{{.+}}({{i8\*|ptr}} align 4 %{{[0-9]+}}, {{i8\*|ptr}} align 4 {{.*}}[[LOW_HIGH]]{{.*}}, i{{(32|64)}} 8, i1 false)
54+
// CHECK: memcpy.{{.+}}(ptr align 4 %_0, ptr align 4 {{.*}}[[LOW_HIGH]]{{.*}}, i{{(32|64)}} 8, i1 false)
5455
*&E::A(0)
5556
}

tests/codegen/enum-match.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ pub enum Enum0 {
1515
// CHECK-NEXT: start:
1616
// CHECK-NEXT: %1 = icmp eq i8 %0, 2
1717
// CHECK-NEXT: %2 = and i8 %0, 1
18-
// CHECK-NEXT: %.0 = select i1 %1, i8 13, i8 %2
18+
// CHECK-NEXT: %_0.0 = select i1 %1, i8 13, i8 %2
1919
#[no_mangle]
2020
pub fn match0(e: Enum0) -> u8 {
2121
use Enum0::*;

tests/codegen/fewer-names.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ pub fn sum(x: u32, y: u32) -> u32 {
1313

1414
// NO-LABEL: define{{.*}}i32 @sum(i32 noundef %x, i32 noundef %y)
1515
// NO-NEXT: start:
16-
// NO-NEXT: %0 = add i32 %y, %x
17-
// NO-NEXT: ret i32 %0
16+
// NO-NEXT: %z = add i32 %y, %x
17+
// NO-NEXT: ret i32 %z
1818
let z = x + y;
1919
z
2020
}

tests/codegen/function-arguments-noopt.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ pub fn borrow_call(x: &i32, f: fn(&i32) -> &i32) -> &i32 {
4242
f(x)
4343
}
4444

45-
// CHECK: void @struct_({{%S\*|ptr}} sret(%S){{( %0)?}}, {{%S\*|ptr}} %x)
45+
// CHECK: void @struct_({{%S\*|ptr}} sret(%S){{( %_0)?}}, {{%S\*|ptr}} %x)
4646
#[no_mangle]
4747
pub fn struct_(x: S) -> S {
4848
x
@@ -51,7 +51,7 @@ pub fn struct_(x: S) -> S {
5151
// CHECK-LABEL: @struct_call
5252
#[no_mangle]
5353
pub fn struct_call(x: S, f: fn(S) -> S) -> S {
54-
// CHECK: call void %f({{%S\*|ptr}} sret(%S){{( %0)?}}, {{%S\*|ptr}} %{{.+}})
54+
// CHECK: call void %f({{%S\*|ptr}} sret(%S){{( %_0)?}}, {{%S\*|ptr}} %{{.+}})
5555
f(x)
5656
}
5757

tests/codegen/function-arguments.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ pub fn notunpin_box(x: Box<NotUnpin>) -> Box<NotUnpin> {
188188
x
189189
}
190190

191-
// CHECK: @struct_return({{%S\*|ptr}} noalias nocapture noundef sret(%S) dereferenceable(32){{( %0)?}})
191+
// CHECK: @struct_return({{%S\*|ptr}} noalias nocapture noundef sret(%S) dereferenceable(32){{( %_0)?}})
192192
#[no_mangle]
193193
pub fn struct_return() -> S {
194194
S {

tests/codegen/intrinsics/transmute-niched.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -169,16 +169,16 @@ pub unsafe fn check_bool_from_ordering(x: std::cmp::Ordering) -> bool {
169169
// CHECK-LABEL: @check_bool_to_ordering(
170170
#[no_mangle]
171171
pub unsafe fn check_bool_to_ordering(x: bool) -> std::cmp::Ordering {
172-
// CHECK: %0 = zext i1 %x to i8
173-
// OPT: %1 = icmp ule i8 %0, 1
174-
// OPT: call void @llvm.assume(i1 %1)
175-
// OPT: %2 = icmp uge i8 %0, -1
176-
// OPT: %3 = icmp ule i8 %0, 1
177-
// OPT: %4 = or i1 %2, %3
178-
// OPT: call void @llvm.assume(i1 %4)
172+
// CHECK: %_0 = zext i1 %x to i8
173+
// OPT: %0 = icmp ule i8 %_0, 1
174+
// OPT: call void @llvm.assume(i1 %0)
175+
// OPT: %1 = icmp uge i8 %_0, -1
176+
// OPT: %2 = icmp ule i8 %_0, 1
177+
// OPT: %3 = or i1 %1, %2
178+
// OPT: call void @llvm.assume(i1 %3)
179179
// DBG-NOT: icmp
180180
// DBG-NOT: assume
181-
// CHECK: ret i8 %0
181+
// CHECK: ret i8 %_0
182182

183183
transmute(x)
184184
}

tests/codegen/intrinsics/transmute-x64.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -11,25 +11,25 @@ use std::mem::transmute;
1111
#[no_mangle]
1212
pub unsafe fn check_sse_float_to_int(x: __m128) -> __m128i {
1313
// CHECK-NOT: alloca
14-
// CHECK: %1 = load <4 x float>, ptr %x, align 16
15-
// CHECK: store <4 x float> %1, ptr %0, align 16
14+
// CHECK: %0 = load <4 x float>, ptr %x, align 16
15+
// CHECK: store <4 x float> %0, ptr %_0, align 16
1616
transmute(x)
1717
}
1818

1919
// CHECK-LABEL: @check_sse_pair_to_avx(
2020
#[no_mangle]
2121
pub unsafe fn check_sse_pair_to_avx(x: (__m128i, __m128i)) -> __m256i {
2222
// CHECK-NOT: alloca
23-
// CHECK: %1 = load <4 x i64>, ptr %x, align 16
24-
// CHECK: store <4 x i64> %1, ptr %0, align 32
23+
// CHECK: %0 = load <4 x i64>, ptr %x, align 16
24+
// CHECK: store <4 x i64> %0, ptr %_0, align 32
2525
transmute(x)
2626
}
2727

2828
// CHECK-LABEL: @check_sse_pair_from_avx(
2929
#[no_mangle]
3030
pub unsafe fn check_sse_pair_from_avx(x: __m256i) -> (__m128i, __m128i) {
3131
// CHECK-NOT: alloca
32-
// CHECK: %1 = load <4 x i64>, ptr %x, align 32
33-
// CHECK: store <4 x i64> %1, ptr %0, align 16
32+
// CHECK: %0 = load <4 x i64>, ptr %x, align 32
33+
// CHECK: store <4 x i64> %0, ptr %_0, align 16
3434
transmute(x)
3535
}

0 commit comments

Comments
 (0)