|
1 |
| -//@ compile-flags: -Copt-level=3 -g -Zverify-llvm-ir |
| 1 | +//@ compile-flags: -Copt-level=3 -g -Zverify-llvm-ir -Zmerge-functions=disabled |
2 | 2 | //@ revisions: CODEGEN OPTIMIZED
|
3 | 3 | //@[CODEGEN] compile-flags: -Cno-prepopulate-passes
|
4 | 4 | // ignore-tidy-linelength
|
|
9 | 9 | #[derive(Clone, Copy)]
|
10 | 10 | pub struct Foo(i32, i64, i32);
|
11 | 11 |
|
| 12 | +#[repr(C)] |
| 13 | +pub struct Bar<'a> { |
| 14 | + a: i32, |
| 15 | + b: i64, |
| 16 | + foo: &'a Foo, |
| 17 | +} |
| 18 | + |
12 | 19 | #[no_mangle]
|
13 | 20 | fn r#ref(ref_foo: &Foo) -> i32 {
|
14 | 21 | // CHECK-LABEL: define{{.*}} i32 @ref
|
@@ -78,11 +85,20 @@ pub fn fragment(fragment_v1: Foo, mut fragment_v2: Foo) -> Foo {
|
78 | 85 | fragment_v2
|
79 | 86 | }
|
80 | 87 |
|
| 88 | +#[no_mangle] |
| 89 | +pub fn deref(bar: Bar) -> i32 { |
| 90 | + // CHECK-LABEL: define {{.*}} i32 @deref |
| 91 | + // We are unable to represent dereference within this expression. |
| 92 | + // CHECK: #dbg_value(ptr poison, [[VAR_deref_dead:![0-9]+]], !DIExpression() |
| 93 | + let deref_dead = &bar.foo.2; |
| 94 | + bar.a |
| 95 | +} |
| 96 | + |
81 | 97 | #[no_mangle]
|
82 | 98 | pub fn tuple(foo: (i32, &Foo)) -> i32 {
|
83 | 99 | // CHECK-LABEL: define{{.*}} i32 @tuple
|
84 |
| - // CHECK-SAME: (i32 {{.*}}, ptr {{.*}} [[ARG_tuple_foo_1:%.*]]) |
85 |
| - // CHECK: #dbg_value(ptr [[ARG_tuple_foo_1]], [[VAR_tuple_dead:![0-9]+]], !DIExpression(DW_OP_plus_uconst, 16, DW_OP_stack_value) |
| 100 | + // Although there is no dereference here, there is a dereference in the MIR. |
| 101 | + // CHECK: #dbg_value(ptr poison, [[VAR_tuple_dead:![0-9]+]], !DIExpression() |
86 | 102 | let tuple_dead = &foo.1.2;
|
87 | 103 | foo.1.0
|
88 | 104 | }
|
@@ -148,6 +164,7 @@ pub fn non_arg_ref(scalar: i32, foo: Foo, a: &i32) -> i32 {
|
148 | 164 | // CHECK-DAG: [[VAR_ptr_v2]] = !DILocalVariable(name: "ptr_v2"
|
149 | 165 | // CODEGEN-DAG: [[VAR_val_ref]] = !DILocalVariable(name: "val_ref"
|
150 | 166 | // CHECK-DAG: [[VAR_fragment_f]] = !DILocalVariable(name: "fragment_f"
|
| 167 | +// CHECK-DAG: [[VAR_deref_dead]] = !DILocalVariable(name: "deref_dead" |
151 | 168 | // CHECK-DAG: [[VAR_tuple_dead]] = !DILocalVariable(name: "tuple_dead"
|
152 | 169 | // CHECK-DAG: [[ARG_dead_first_foo]] = !DILocalVariable(name: "dead_first_foo"
|
153 | 170 | // CHECK-DAG: [[VAR_dead_first_v0]] = !DILocalVariable(name: "dead_first_v0"
|
|
0 commit comments