Skip to content

Commit

Permalink
Auto merge of #124830 - aeubanks:dbg, r=durin42
Browse files Browse the repository at this point in the history
Adjust dbg.value/dbg.declare checks for LLVM update

llvm/llvm-project#89799 changes llvm.dbg.value/declare intrinsics to be in a different, out-of-instruction-line representation. For example
  call void `@llvm.dbg.declare(...)`
becomes
  #dbg_declare(...)

Update tests accordingly to work with both the old and new way.
  • Loading branch information
bors committed May 7, 2024
2 parents 7d83a4c + 6c348ac commit 5ae5d13
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion tests/codegen/debug-fndef-size.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ pub fn main() {
}

// CHECK: %compare.dbg.spill = alloca [0 x i8], align 1
// CHECK: call void @llvm.dbg.declare(metadata ptr %compare.dbg.spill, metadata ![[VAR:.*]], metadata !DIExpression()), !dbg !{{.*}}
// CHECK: dbg{{.}}declare({{(metadata )?}}ptr %compare.dbg.spill, {{(metadata )?}}![[VAR:.*]], {{(metadata )?}}!DIExpression()
// CHECK: ![[TYPE:.*]] = !DIDerivedType(tag: DW_TAG_pointer_type, name: "fn(&i32, &i32) -> core::cmp::Ordering", baseType: !{{.*}}, align: 1, dwarfAddressSpace: {{.*}})
// CHECK: ![[VAR]] = !DILocalVariable(name: "compare", scope: !{{.*}}, file: !{{.*}}, line: {{.*}}, type: ![[TYPE]], align: 1)
4 changes: 2 additions & 2 deletions tests/codegen/debuginfo-constant-locals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ fn foo(x: i32) {
}

// CHECK-LABEL: @check_it
// CHECK: call void @llvm.dbg.value(metadata i32 1, metadata ![[a_metadata:[0-9]+]], metadata !DIExpression())
// CHECK: call void @llvm.dbg.value(metadata i32 42, metadata ![[b_metadata:[0-9]+]], metadata !DIExpression())
// CHECK: dbg{{.}}value({{(metadata )?}}i32 1, {{(metadata )?}}![[a_metadata:[0-9]+]], {{(metadata )?}}!DIExpression()
// CHECK: dbg{{.}}value({{(metadata )?}}i32 42, {{(metadata )?}}![[b_metadata:[0-9]+]], {{(metadata )?}}!DIExpression()

// CHECK: ![[a_metadata]] = !DILocalVariable(name: "a"
// CHECK-SAME: line: 9
Expand Down
2 changes: 1 addition & 1 deletion tests/codegen/inline-debuginfo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pub extern "C" fn callee(x: u32) -> u32 {
}

// CHECK-LABEL: caller
// CHECK: call void @llvm.dbg.value(metadata i32 %y, metadata !{{.*}}, metadata !DIExpression(DW_OP_constu, 3, DW_OP_minus, DW_OP_stack_value)), !dbg [[A:!.*]]
// CHECK: dbg{{.}}value({{(metadata )?}}i32 %y, {{(metadata )?}}!{{.*}}, {{(metadata )?}}!DIExpression(DW_OP_constu, 3, DW_OP_minus, DW_OP_stack_value){{.*}} [[A:![0-9]+]]
// CHECK: [[A]] = !DILocation(line: {{.*}}, scope: {{.*}}, inlinedAt: {{.*}})
#[no_mangle]
pub extern "C" fn caller(y: u32) -> u32 {
Expand Down
12 changes: 6 additions & 6 deletions tests/codegen/sroa-fragment-debuginfo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ pub fn extra(s: &[u8]) {
// CHECK: %slice.dbg.spill1 = alloca [4 x i8],
// CHECK: %slice.dbg.spill = alloca [16 x i8],
// CHECK: %s.dbg.spill = alloca [16 x i8],
// 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)),
// CHECK: dbg{{.}}declare({{(metadata )?}}ptr %s.dbg.spill, {{(metadata )?}}![[S_EXTRA:.*]], {{(metadata )?}}!DIExpression()
// CHECK: dbg{{.}}declare({{(metadata )?}}ptr %slice.dbg.spill, {{(metadata )?}}![[SLICE_EXTRA:.*]], {{(metadata )?}}!DIExpression(DW_OP_LLVM_fragment, 0, 128)
// CHECK: 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 };
}

Expand All @@ -36,9 +36,9 @@ pub fn zst(s: &[u8]) {
// variable, so is not a fragment. In that case, the variable must have no fragment.

// CHECK: void @zst(
// CHECK-NOT: call void @llvm.dbg.declare(metadata ptr %slice.dbg.spill, metadata !{}, metadata !DIExpression(DW_OP_LLVM_fragment,
// CHECK: call void @llvm.dbg.declare(metadata ptr %{{.*}}, metadata ![[SLICE_ZST:.*]], metadata !DIExpression()),
// CHECK-NOT: call void @llvm.dbg.declare(metadata ptr %{{.*}}, metadata ![[SLICE_ZST]],
// CHECK-NOT: dbg{{.}}declare({{(metadata )?}}ptr %slice.dbg.spill, {{(metadata )?}}!{}, {{(metadata )?}}!DIExpression(DW_OP_LLVM_fragment,
// CHECK: dbg{{.}}declare({{(metadata )?}}ptr %{{.*}}, {{(metadata )?}}![[SLICE_ZST:.*]], {{(metadata )?}}!DIExpression()
// CHECK-NOT: dbg{{.}}declare({{(metadata )?}}ptr %{{.*}}, {{(metadata )?}}![[SLICE_ZST]],
let slice = ZstSlice { slice: s, extra: Zst };
}

Expand Down

0 comments on commit 5ae5d13

Please sign in to comment.