1 ; RUN: not llvm-as -disable-output <%s 2>&1 | FileCheck %s 2 define void @foo() { 3 entry: 4 call void @llvm.dbg.value( 5 metadata i8* undef, 6 i64 0, 7 metadata !DILocalVariable(scope: !1), 8 metadata !DIExpression()) 9 ; CHECK-LABEL: llvm.dbg.value intrinsic requires a !dbg attachment 10 ; CHECK-NEXT: call void @llvm.dbg.value({{.*}}) 11 ; CHECK-NEXT: label %entry 12 ; CHECK-NEXT: void ()* @foo 13 14 call void @llvm.dbg.declare( 15 metadata i8* undef, 16 metadata !DILocalVariable(scope: !1), 17 metadata !DIExpression()) 18 ; CHECK-LABEL: llvm.dbg.declare intrinsic requires a !dbg attachment 19 ; CHECK-NEXT: call void @llvm.dbg.declare({{.*}}) 20 ; CHECK-NEXT: label %entry 21 ; CHECK-NEXT: void ()* @foo 22 23 call void @llvm.dbg.value( 24 metadata i8* undef, 25 i64 0, 26 metadata !DILocalVariable(scope: !1), 27 metadata !DIExpression()), 28 !dbg !DILocation(scope: !2) 29 ; CHECK-LABEL: mismatched subprogram between llvm.dbg.value variable and !dbg attachment 30 ; CHECK-NEXT: call void @llvm.dbg.value({{[^,]+, [^,]+}}, metadata ![[VAR:[0-9]+]], {{[^,]+}}), !dbg ![[LOC:[0-9]+]] 31 ; CHECK-NEXT: label %entry 32 ; CHECK-NEXT: void ()* @foo 33 ; CHECK-NEXT: ![[VAR]] = !DILocalVariable({{.*}}scope: ![[VARSP:[0-9]+]] 34 ; CHECK-NEXT: ![[VARSP]] = distinct !DISubprogram( 35 ; CHECK-NEXT: ![[LOC]] = !DILocation({{.*}}scope: ![[LOCSP:[0-9]+]] 36 ; CHECK-NEXT: ![[LOCSP]] = distinct !DISubprogram( 37 38 call void @llvm.dbg.declare( 39 metadata i8* undef, 40 metadata !DILocalVariable(scope: !1), 41 metadata !DIExpression()), 42 !dbg !DILocation(scope: !2) 43 ; CHECK-LABEL: mismatched subprogram between llvm.dbg.declare variable and !dbg attachment 44 ; CHECK-NEXT: call void @llvm.dbg.declare({{[^,]+}}, metadata ![[VAR:[0-9]+]], {{.*[^,]+}}), !dbg ![[LOC:[0-9]+]] 45 ; CHECK-NEXT: label %entry 46 ; CHECK-NEXT: void ()* @foo 47 ; CHECK-NEXT: ![[VAR]] = !DILocalVariable({{.*}}scope: ![[VARSP:[0-9]+]] 48 ; CHECK-NEXT: ![[VARSP]] = distinct !DISubprogram( 49 ; CHECK-NEXT: ![[LOC]] = !DILocation({{.*}}scope: ![[LOCSP:[0-9]+]] 50 ; CHECK-NEXT: ![[LOCSP]] = distinct !DISubprogram( 51 52 ret void 53 } 54 55 declare void @llvm.dbg.value(metadata, i64, metadata, metadata) 56 declare void @llvm.dbg.declare(metadata, metadata, metadata) 57 58 !llvm.module.flags = !{!0} 59 !0 = !{i32 2, !"Debug Info Version", i32 3} 60 !1 = distinct !DISubprogram(name: "foo") 61 !2 = distinct !DISubprogram(name: "bar") 62