Rewrite test/Feature/md_on_instruction.ll

This test is supposed to be testing whether metadata attachments to
instructions work, but it was using invalid debug info to do so.  (This
was causing assertion failures in the `DebugInfoFinder` with a WIP patch
to be more strict about `DIDescriptor` accessors.)

Rather than fix the debug info -- which is better tested elsewhere --
just test the IR feature directly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232828 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Duncan P. N. Exon Smith 2015-03-20 18:34:53 +00:00
parent 8979e3f69b
commit 1188480049

View File

@ -1,27 +1,28 @@
; RUN: llvm-as < %s | llvm-dis | grep " !dbg " | count 4
; RUN: llvm-as < %s | llvm-dis | llvm-as | llvm-dis | FileCheck %s
define i32 @foo() nounwind ssp {
entry:
%retval = alloca i32 ; <i32*> [#uses=2]
call void @llvm.dbg.func.start(metadata !0)
store i32 42, i32* %retval, !dbg !3
br label %0, !dbg !3
; CHECK: %retval = alloca i32
; CHECK: store i32 42, i32* %retval, !md !0
; CHECK: br label %0, !md !1
%retval = alloca i32
store i32 42, i32* %retval, !md !0
br label %0, !md !1
; <label>:0 ; preds = %entry
call void @llvm.dbg.region.end(metadata !0)
%1 = load i32, i32* %retval, !dbg !3 ; <i32> [#uses=1]
ret i32 %1, !dbg !3
; <label:0>
; CHECK: %1 = load i32, i32* %retval, !md !2
; CHECK: ret i32 %1, !md !3
%1 = load i32, i32* %retval, !md !2
ret i32 %1, !md !3
}
declare void @llvm.dbg.func.start(metadata) nounwind readnone
declare void @llvm.dbg.region.end(metadata) nounwind readnone
!llvm.module.flags = !{!6}
!0 = !MDSubprogram(name: "foo", linkageName: "foo", line: 1, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: false, scope: !1, type: !2)
!1 = !MDCompileUnit(language: DW_LANG_C99, producer: "clang 1.0", isOptimized: true, emissionKind: 0, file: !4, enums: !5, retainedTypes: !5, subprograms: !4)
!2 = !MDBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
!3 = !MDLocation(line: 1, column: 13, scope: !1, inlinedAt: !1)
!4 = !MDFile(filename: "foo.c", directory: "/tmp")
!5 = !{i32 0}
!6 = !{i32 1, !"Debug Info Version", i32 3}
; CHECK: !0 = !{}
; CHECK: !1 = distinct !{}
; CHECK: !2 = !{!0}
; CHECK: !3 = !{!4}
; CHECK: !4 = !{!0, !2}
!0 = !{}
!1 = distinct !{}
!2 = !{!0}
!3 = !{!4}
!4 = !{!0, !2}