Assembler: Rewrite test for function-local metadata

This test for function-local metadata did strange things, and never
really sent in valid arguments for `llvm.dbg.declare` and
`llvm.dbg.value` intrinsics.  Those that might have once been valid have
bitrotted.

Rewrite it to be a targeted test for function-local metadata --
unrelated to debug info, which is tested elsewhere -- and rename it to
better match other metadata-related tests.

(Note: the scope of function-local metadata changed drastically during
the metadata/value split, but I didn't properly clean up this testcase.
Most of the IR in this file, while invalid for debug info intrinsics,
used to provide coverage for various (now illegal) forms of
function-local metadata.)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232290 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Duncan P. N. Exon Smith 2015-03-15 00:45:51 +00:00
parent 54db4092c1
commit f548941ee0
2 changed files with 20 additions and 55 deletions

View File

@ -1,55 +0,0 @@
; RUN: llvm-as < %s | llvm-dis | FileCheck %s
; RUN: verify-uselistorder %s
define void @Foo(i32 %a, i32 %b) {
entry:
call void @llvm.dbg.value(metadata i32* %1, i64 16, metadata !2, metadata !MDExpression())
; CHECK: call void @llvm.dbg.value(metadata i32* %1, i64 16, metadata ![[ID2:[0-9]+]], metadata {{.*}})
%0 = add i32 %a, 1 ; <i32> [#uses=1]
%two = add i32 %b, %0 ; <i32> [#uses=0]
%1 = alloca i32 ; <i32*> [#uses=1]
call void @llvm.dbg.declare(metadata i32* %1, metadata i32* %1, metadata !MDExpression())
; CHECK: call void @llvm.dbg.declare(metadata i32* %1, metadata i32* %1, metadata {{.*}})
call void @llvm.dbg.declare(metadata i32 %two, metadata i32 %0, metadata !MDExpression())
; CHECK: call void @llvm.dbg.declare(metadata i32 %two, metadata i32 %0, metadata {{.*}})
call void @llvm.dbg.declare(metadata i32* %1, metadata i32 %b, metadata !MDExpression())
; CHECK: call void @llvm.dbg.declare(metadata i32* %1, metadata i32 %b, metadata {{.*}})
call void @llvm.dbg.declare(metadata i32 %a, metadata i32 %a, metadata !MDExpression())
; CHECK: call void @llvm.dbg.declare(metadata i32 %a, metadata i32 %a, metadata {{.*}})
call void @llvm.dbg.declare(metadata i32 %b, metadata i32 %two, metadata !MDExpression())
; CHECK: call void @llvm.dbg.declare(metadata i32 %b, metadata i32 %two, metadata {{.*}})
call void @llvm.dbg.value(metadata i32 %a, i64 0, metadata !1, metadata !MDExpression())
; CHECK: call void @llvm.dbg.value(metadata i32 %a, i64 0, metadata ![[ID1:[0-9]+]], metadata {{.*}})
call void @llvm.dbg.value(metadata i32 %0, i64 25, metadata !0, metadata !MDExpression())
; CHECK: call void @llvm.dbg.value(metadata i32 %0, i64 25, metadata ![[ID0:[0-9]+]], metadata {{.*}})
call void @llvm.dbg.value(metadata i32* %1, i64 16, metadata !3, metadata !MDExpression())
; CHECK: call void @llvm.dbg.value(metadata i32* %1, i64 16, metadata ![[ID3:[0-9]+]], metadata {{.*}})
call void @llvm.dbg.value(metadata !3, i64 12, metadata !2, metadata !MDExpression())
; CHECK: call void @llvm.dbg.value(metadata ![[ID3]], i64 12, metadata ![[ID2]], metadata {{.*}})
ret void, !foo !0, !bar !1
; CHECK: ret void, !foo ![[FOO:[0-9]+]], !bar ![[BAR:[0-9]+]]
}
!llvm.module.flags = !{!4}
!0 = !MDLocation(line: 662302, column: 26, scope: !1)
!1 = !{i32 4, !"foo"}
!2 = !{!"bar"}
!3 = !{!"foo"}
!4 = !{i32 1, !"Debug Info Version", i32 3}
declare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone
declare void @llvm.dbg.value(metadata, i64, metadata, metadata) nounwind readnone
!foo = !{ !0 }
!bar = !{ !1 }
; CHECK: !foo = !{![[FOO]]}
; CHECK: !bar = !{![[BAR]]}
; CHECK: ![[ID0]] = !MDLocation(line: 662302, column: 26, scope: ![[ID1]])
; CHECK: ![[ID1]] = !{i32 4, !"foo"}
; CHECK: ![[ID2]] = !{!"bar"}
; CHECK: ![[ID3]] = !{!"foo"}

View File

@ -0,0 +1,20 @@
; RUN: llvm-as < %s | llvm-dis | llvm-as | llvm-dis | FileCheck %s
; RUN: verify-uselistorder %s
declare void @llvm.metadata(metadata)
define void @foo(i32 %arg) {
entry:
%before = alloca i32
call void @llvm.metadata(metadata i32 %arg)
call void @llvm.metadata(metadata i32* %after)
call void @llvm.metadata(metadata i32* %before)
%after = alloca i32
ret void
; CHECK: %before = alloca i32
; CHECK: call void @llvm.metadata(metadata i32 %arg)
; CHECK: call void @llvm.metadata(metadata i32* %after)
; CHECK: call void @llvm.metadata(metadata i32* %before)
; CHECK: %after = alloca i32
}