diff --git a/tests/codegen/sroa-fragment-debuginfo.rs b/tests/codegen/sroa-fragment-debuginfo.rs index ee103cf1c8e..dbde2226e5a 100644 --- a/tests/codegen/sroa-fragment-debuginfo.rs +++ b/tests/codegen/sroa-fragment-debuginfo.rs @@ -3,25 +3,43 @@ #![crate_type = "lib"] -pub struct Endian; - -#[allow(dead_code)] -pub struct EndianSlice<'input> { +pub struct ExtraSlice<'input> { slice: &'input [u8], - endian: Endian, + extra: u32, } #[no_mangle] -pub fn test(s: &[u8]) { -// CHECK: void @test( -// CHECK: %slice.dbg.spill1 = alloca { ptr, i64 }, -// CHECK: %slice.dbg.spill = alloca %Endian, +pub fn extra(s: &[u8]) { +// CHECK: void @extra( +// CHECK: %slice.dbg.spill1 = alloca i32, +// CHECK: %slice.dbg.spill = alloca { ptr, i64 }, // CHECK: %s.dbg.spill = alloca { ptr, i64 }, -// CHECK: call void @llvm.dbg.declare(metadata ptr %s.dbg.spill, metadata ![[S:.*]], metadata !DIExpression()), -// CHECK: call void @llvm.dbg.declare(metadata ptr %slice.dbg.spill, metadata ![[SLICE:.*]], metadata !DIExpression(DW_OP_LLVM_fragment, 0, 0)), -// CHECK: call void @llvm.dbg.declare(metadata ptr %slice.dbg.spill1, metadata ![[SLICE]], metadata !DIExpression()), - let slice = EndianSlice { slice: s, endian: Endian }; +// CHECK: call void @llvm.dbg.declare(metadata ptr %s.dbg.spill, metadata ![[S_EXTRA:.*]], metadata !DIExpression()), +// CHECK: call void @llvm.dbg.declare(metadata ptr %slice.dbg.spill, metadata ![[SLICE_EXTRA:.*]], metadata !DIExpression(DW_OP_LLVM_fragment, 0, 128)), +// CHECK: call void @llvm.dbg.declare(metadata ptr %slice.dbg.spill1, metadata ![[SLICE_EXTRA]], metadata !DIExpression(DW_OP_LLVM_fragment, 128, 32)), + let slice = ExtraSlice { slice: s, extra: s.len() as u32 }; } -// CHECK: ![[S]] = !DILocalVariable(name: "s", -// CHECK: ![[SLICE]] = !DILocalVariable(name: "slice", +struct Zst; + +pub struct ZstSlice<'input> { + slice: &'input [u8], + extra: Zst, +} + +#[no_mangle] +pub fn zst(s: &[u8]) { +// CHECK: void @zst( +// CHECK: %slice.dbg.spill1 = alloca { ptr, i64 }, +// CHECK: %slice.dbg.spill = alloca %Zst, +// CHECK: %s.dbg.spill = alloca { ptr, i64 }, +// CHECK: call void @llvm.dbg.declare(metadata ptr %s.dbg.spill, metadata ![[S_ZST:.*]], metadata !DIExpression()), +// CHECK: call void @llvm.dbg.declare(metadata ptr %slice.dbg.spill, metadata ![[SLICE_ZST:.*]], metadata !DIExpression(DW_OP_LLVM_fragment, 0, 0)), +// CHECK: call void @llvm.dbg.declare(metadata ptr %slice.dbg.spill1, metadata ![[SLICE_ZST]], metadata !DIExpression()), + let slice = ZstSlice { slice: s, extra: Zst }; +} + +// CHECK: ![[S_EXTRA]] = !DILocalVariable(name: "s", +// CHECK: ![[SLICE_EXTRA]] = !DILocalVariable(name: "slice", +// CHECK: ![[S_ZST]] = !DILocalVariable(name: "s", +// CHECK: ![[SLICE_ZST]] = !DILocalVariable(name: "slice",