mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-20 12:31:40 +00:00
94255c8eb0
Before we start to rely on valid `!dbg` attachments, add a check to the verifier that `@llvm.dbg.*` intrinsics always have one. Also check that the `scope:` fields point at the same `MDSubprogram`. This is in the context of PR22778. The check that the `inlinedAt:` fields agree has baked for a while (since r234021), so I'll kill [1] the `MDLocalVariable::getInlinedAt()` field soon. [1]: http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20150330/269387.html Unfortunately, that means it's impossible to keep the current `Verifier` checks, which rely on comparing `inlinedAt:` fields. We'll be able to keep the checks I'm adding here. If this breaks your out-of-tree testcases, the upgrade script (add-dbg-to-intrinsics.sh) attached to PR22778 that I used for r235040 might fix them for you. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235048 91177308-0d34-0410-b5e6-96231b3b80d8
62 lines
2.3 KiB
LLVM
62 lines
2.3 KiB
LLVM
; RUN: not llvm-as -disable-output <%s 2>&1 | FileCheck %s
|
|
define void @foo() {
|
|
entry:
|
|
call void @llvm.dbg.value(
|
|
metadata i8* undef,
|
|
i64 0,
|
|
metadata !MDLocalVariable(tag: DW_TAG_arg_variable, scope: !1),
|
|
metadata !MDExpression())
|
|
; CHECK-LABEL: llvm.dbg.value intrinsic requires a !dbg attachment
|
|
; CHECK-NEXT: call void @llvm.dbg.value({{.*}})
|
|
; CHECK-NEXT: label %entry
|
|
; CHECK-NEXT: void ()* @foo
|
|
|
|
call void @llvm.dbg.declare(
|
|
metadata i8* undef,
|
|
metadata !MDLocalVariable(tag: DW_TAG_arg_variable, scope: !1),
|
|
metadata !MDExpression())
|
|
; CHECK-LABEL: llvm.dbg.declare intrinsic requires a !dbg attachment
|
|
; CHECK-NEXT: call void @llvm.dbg.declare({{.*}})
|
|
; CHECK-NEXT: label %entry
|
|
; CHECK-NEXT: void ()* @foo
|
|
|
|
call void @llvm.dbg.value(
|
|
metadata i8* undef,
|
|
i64 0,
|
|
metadata !MDLocalVariable(tag: DW_TAG_arg_variable, scope: !1),
|
|
metadata !MDExpression()),
|
|
!dbg !MDLocation(scope: !2)
|
|
; CHECK-LABEL: mismatched subprogram between llvm.dbg.value variable and !dbg attachment
|
|
; CHECK-NEXT: call void @llvm.dbg.value({{[^,]+, [^,]+}}, metadata ![[VAR:[0-9]+]], {{[^,]+}}), !dbg ![[LOC:[0-9]+]]
|
|
; CHECK-NEXT: label %entry
|
|
; CHECK-NEXT: void ()* @foo
|
|
; CHECK-NEXT: ![[VAR]] = !MDLocalVariable({{.*}}scope: ![[VARSP:[0-9]+]]
|
|
; CHECK-NEXT: ![[VARSP]] = !MDSubprogram(
|
|
; CHECK-NEXT: ![[LOC]] = !MDLocation({{.*}}scope: ![[LOCSP:[0-9]+]]
|
|
; CHECK-NEXT: ![[LOCSP]] = !MDSubprogram(
|
|
|
|
call void @llvm.dbg.declare(
|
|
metadata i8* undef,
|
|
metadata !MDLocalVariable(tag: DW_TAG_arg_variable, scope: !1),
|
|
metadata !MDExpression()),
|
|
!dbg !MDLocation(scope: !2)
|
|
; CHECK-LABEL: mismatched subprogram between llvm.dbg.declare variable and !dbg attachment
|
|
; CHECK-NEXT: call void @llvm.dbg.declare({{[^,]+}}, metadata ![[VAR:[0-9]+]], {{.*[^,]+}}), !dbg ![[LOC:[0-9]+]]
|
|
; CHECK-NEXT: label %entry
|
|
; CHECK-NEXT: void ()* @foo
|
|
; CHECK-NEXT: ![[VAR]] = !MDLocalVariable({{.*}}scope: ![[VARSP:[0-9]+]]
|
|
; CHECK-NEXT: ![[VARSP]] = !MDSubprogram(
|
|
; CHECK-NEXT: ![[LOC]] = !MDLocation({{.*}}scope: ![[LOCSP:[0-9]+]]
|
|
; CHECK-NEXT: ![[LOCSP]] = !MDSubprogram(
|
|
|
|
ret void
|
|
}
|
|
|
|
declare void @llvm.dbg.value(metadata, i64, metadata, metadata)
|
|
declare void @llvm.dbg.declare(metadata, metadata, metadata)
|
|
|
|
!llvm.module.flags = !{!0}
|
|
!0 = !{i32 2, !"Debug Info Version", i32 3}
|
|
!1 = !MDSubprogram(name: "foo")
|
|
!2 = !MDSubprogram(name: "bar")
|