Skip to content

Commit

Permalink
Add test with non-ZST.
Browse files Browse the repository at this point in the history
  • Loading branch information
cjgillot committed Aug 26, 2023
1 parent b3bbc22 commit f49494e
Showing 1 changed file with 31 additions and 13 deletions.
44 changes: 31 additions & 13 deletions tests/codegen/sroa-fragment-debuginfo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,43 @@

#![crate_type = "lib"]

pub struct Endian;
pub struct ExtraSlice<'input> {
slice: &'input [u8],
extra: u32,
}

#[no_mangle]
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_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 };
}

struct Zst;

#[allow(dead_code)]
pub struct EndianSlice<'input> {
pub struct ZstSlice<'input> {
slice: &'input [u8],
endian: Endian,
extra: Zst,
}

#[no_mangle]
pub fn test(s: &[u8]) {
// CHECK: void @test(
pub fn zst(s: &[u8]) {
// CHECK: void @zst(
// CHECK: %slice.dbg.spill1 = alloca { ptr, i64 },
// CHECK: %slice.dbg.spill = alloca %Endian,
// 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:.*]], 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_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]] = !DILocalVariable(name: "s",
// CHECK: ![[SLICE]] = !DILocalVariable(name: "slice",
// CHECK: ![[S_EXTRA]] = !DILocalVariable(name: "s",
// CHECK: ![[SLICE_EXTRA]] = !DILocalVariable(name: "slice",
// CHECK: ![[S_ZST]] = !DILocalVariable(name: "s",
// CHECK: ![[SLICE_ZST]] = !DILocalVariable(name: "slice",

0 comments on commit f49494e

Please sign in to comment.