Cleanup tests to not share a DISubprogram between multiple Functions.

rdar://problem/31926379

llvm-svn: 302166
This commit is contained in:
Adrian Prantl 2017-05-04 16:24:31 +00:00
parent c6bf797e20
commit defc99a94e
10 changed files with 186 additions and 149 deletions

View File

@ -12,33 +12,33 @@ entry:
store i32 %in, i32* %in.addr, align 4
call void @llvm.dbg.declare(metadata i32* %in.addr, metadata !11, metadata !12), !dbg !13
call void @llvm.dbg.declare(metadata i32 %in, metadata !11, metadata !12), !dbg !13
ret void, !dbg !14
ret void, !dbg !13
}
; CHECK-LABEL: name: debug_declare_vla
; CHECK: DBG_VALUE debug-use %{{[0-9]+}}(p0), debug-use _, !11, !12, debug-location !13
define void @debug_declare_vla(i32 %in) #0 !dbg !7 {
; CHECK: DBG_VALUE debug-use %{{[0-9]+}}(p0), debug-use _, !15, !12, debug-location !16
define void @debug_declare_vla(i32 %in) #0 !dbg !14 {
entry:
%vla.addr = alloca i32, i32 %in
call void @llvm.dbg.declare(metadata i32* %vla.addr, metadata !11, metadata !12), !dbg !13
ret void, !dbg !14
call void @llvm.dbg.declare(metadata i32* %vla.addr, metadata !15, metadata !12), !dbg !16
ret void, !dbg !16
}
; CHECK-LABEL: name: debug_value
; CHECK: [[IN:%[0-9]+]](s32) = COPY %w0
define void @debug_value(i32 %in) #0 !dbg !7 {
define void @debug_value(i32 %in) #0 !dbg !17 {
%addr = alloca i32
; CHECK: DBG_VALUE debug-use [[IN]](s32), debug-use _, !11, !12, debug-location !13
call void @llvm.dbg.value(metadata i32 %in, i64 0, metadata !11, metadata !12), !dbg !13
; CHECK: DBG_VALUE debug-use [[IN]](s32), debug-use _, !18, !12, debug-location !19
call void @llvm.dbg.value(metadata i32 %in, i64 0, metadata !18, metadata !12), !dbg !19
store i32 %in, i32* %addr
; CHECK: DBG_VALUE debug-use %1(p0), debug-use _, !11, !15, debug-location !13
call void @llvm.dbg.value(metadata i32* %addr, i64 0, metadata !11, metadata !15), !dbg !13
; CHECK: DBG_VALUE 123, 0, !11, !12, debug-location !13
call void @llvm.dbg.value(metadata i32 123, i64 0, metadata !11, metadata !12), !dbg !13
; CHECK: DBG_VALUE float 1.000000e+00, 0, !11, !12, debug-location !13
call void @llvm.dbg.value(metadata float 1.000000e+00, i64 0, metadata !11, metadata !12), !dbg !13
; CHECK: DBG_VALUE _, 0, !11, !12, debug-location !13
call void @llvm.dbg.value(metadata i32* null, i64 0, metadata !11, metadata !12), !dbg !13
; CHECK: DBG_VALUE debug-use %1(p0), debug-use _, !18, !20, debug-location !19
call void @llvm.dbg.value(metadata i32* %addr, i64 0, metadata !18, metadata !20), !dbg !19
; CHECK: DBG_VALUE 123, 0, !18, !12, debug-location !19
call void @llvm.dbg.value(metadata i32 123, i64 0, metadata !18, metadata !12), !dbg !19
; CHECK: DBG_VALUE float 1.000000e+00, 0, !18, !12, debug-location !19
call void @llvm.dbg.value(metadata float 1.000000e+00, i64 0, metadata !18, metadata !12), !dbg !19
; CHECK: DBG_VALUE _, 0, !18, !12, debug-location !19
call void @llvm.dbg.value(metadata i32* null, i64 0, metadata !18, metadata !12), !dbg !19
ret void
}
@ -64,5 +64,10 @@ declare void @llvm.dbg.value(metadata, i64, metadata, metadata)
!11 = !DILocalVariable(name: "in", arg: 1, scope: !7, file: !1, line: 1, type: !10)
!12 = !DIExpression()
!13 = !DILocation(line: 1, column: 14, scope: !7)
!14 = !DILocation(line: 2, column: 1, scope: !7)
!15 = !DIExpression(DW_OP_deref)
!14 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 1, type: !8, isLocal: false, isDefinition: true, scopeLine: 1, flags: DIFlagPrototyped, isOptimized: false, unit: !0, variables: !2)
!15 = !DILocalVariable(name: "in", arg: 1, scope: !14, file: !1, line: 1, type: !10)
!16 = !DILocation(line: 1, column: 14, scope: !14)
!17 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 1, type: !8, isLocal: false, isDefinition: true, scopeLine: 1, flags: DIFlagPrototyped, isOptimized: false, unit: !0, variables: !2)
!18 = !DILocalVariable(name: "in", arg: 1, scope: !17, file: !1, line: 1, type: !10)
!19 = !DILocation(line: 1, column: 14, scope: !17)
!20 = !DIExpression(DW_OP_deref)

View File

@ -9,8 +9,8 @@
ret void
}
define void @test_dbg_value_dead(i32 %a) !dbg !5 {
call void @llvm.dbg.value(metadata i32 0, i64 0, metadata !7, metadata !9), !dbg !10
define void @test_dbg_value_dead(i32 %a) !dbg !11 {
call void @llvm.dbg.value(metadata i32 0, i64 0, metadata !12, metadata !9), !dbg !13
ret void
}
@ -30,6 +30,9 @@
!8 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
!9 = !DIExpression()
!10 = !DILocation(line: 1, column: 1, scope: !5)
!11 = distinct !DISubprogram(name: "test_dbg_value", scope: !1, file: !1, line: 1, type: !6, isLocal: false, isDefinition: true, scopeLine: 1, flags: DIFlagPrototyped, isOptimized: false, unit: !0, variables: !2)
!12 = !DILocalVariable(name: "in", arg: 1, scope: !11, file: !1, line: 1, type: !8)
!13 = !DILocation(line: 1, column: 1, scope: !11)
...
---

View File

@ -16,12 +16,12 @@ define i32 @f0(%struct.s* byval align 8 %input) !dbg !8 {
; CHECK-LABEL: f1:
; CHECK: DEBUG_VALUE: f:input <- [%RBP+16]
define i32 @f1(%struct.s* byval align 8 %input) !dbg !8 {
define i32 @f1(%struct.s* byval align 8 %input) !dbg !19 {
%val = load i64, i64* @glob
; this alloca should force FP usage.
%stackspace = alloca i32, i64 %val, align 1
store i32* %stackspace, i32** @ptr
call void @llvm.dbg.declare(metadata %struct.s* %input, metadata !4, metadata !17), !dbg !18
call void @llvm.dbg.declare(metadata %struct.s* %input, metadata !20, metadata !17), !dbg !21
ret i32 42
}
@ -37,11 +37,11 @@ define i32 @f1(%struct.s* byval align 8 %input) !dbg !8 {
; The parameter should still be referenced through RBP though.
; CHECK-NOT: DEBUG_VALUE: f:input <- [%RBX
; CHECK: DEBUG_VALUE: f:input <- [%RBP+16]
define i32 @f2(%struct.s* byval align 8 %input) !dbg !8 {
define i32 @f2(%struct.s* byval align 8 %input) !dbg !22 {
%val = load i64, i64* @glob
%stackspace = alloca i32, i64 %val, align 64
store i32* %stackspace, i32** @ptr
call void @llvm.dbg.declare(metadata %struct.s* %input, metadata !4, metadata !17), !dbg !18
call void @llvm.dbg.declare(metadata %struct.s* %input, metadata !23, metadata !17), !dbg !24
ret i32 42
}
@ -73,3 +73,10 @@ declare void @llvm.dbg.declare(metadata, metadata, metadata)
!17 = !DIExpression()
!18 = !DILocation(line: 5, scope: !8)
!19 = distinct !DISubprogram(name: "f", file: !3, line: 5, type: !6, isLocal: false, isDefinition: true, flags: DIFlagPrototyped, unit: !2, variables: !5)
!20 = !DILocalVariable(name: "input", arg: 1, scope: !19, file: !3, line: 5, type: !9)
!21 = !DILocation(line: 5, scope: !19)
!22 = distinct !DISubprogram(name: "f", file: !3, line: 5, type: !6, isLocal: false, isDefinition: true, flags: DIFlagPrototyped, unit: !2, variables: !5)
!23 = !DILocalVariable(name: "input", arg: 1, scope: !22, file: !3, line: 5, type: !9)
!24 = !DILocation(line: 5, scope: !22)

View File

@ -35,8 +35,8 @@ define void @fn2NoDebug(%struct.Buffer* byval align 64 %p1) {
; CHECK-NEXT: pop
; CHECK-NEXT: ret
define void @fn2WithDebug(%struct.Buffer* byval align 64 %p1) !dbg !4 {
call void @llvm.dbg.declare(metadata %struct.Buffer* %p1, metadata !5, metadata !6), !dbg !7
define void @fn2WithDebug(%struct.Buffer* byval align 64 %p1) !dbg !8 {
call void @llvm.dbg.declare(metadata %struct.Buffer* %p1, metadata !9, metadata !6), !dbg !10
ret void
}
@ -64,3 +64,6 @@ declare void @llvm.dbg.declare(metadata, metadata, metadata)
!5 = !DILocalVariable(name: "w", scope: !4)
!6 = !DIExpression()
!7 = !DILocation(line: 210, column: 12, scope: !4)
!8 = distinct !DISubprogram(name: "withDebug", unit: !0)
!9 = !DILocalVariable(name: "w", scope: !8)
!10 = !DILocation(line: 210, column: 12, scope: !8)

View File

@ -32,52 +32,52 @@ bb2: ; preds = %bb1, %bb
ret i32 %tmp3, !dbg !19
}
define i32 @bar_noinline(i32 %arg) local_unnamed_addr #1 !dbg !5 {
define i32 @bar_noinline(i32 %arg) local_unnamed_addr #1 !dbg !23 {
bb:
%tmp = icmp slt i32 %arg, 0, !dbg !7
br i1 %tmp, label %bb1, label %bb2, !dbg !8
%tmp = icmp slt i32 %arg, 0, !dbg !24
br i1 %tmp, label %bb1, label %bb2, !dbg !24
bb1: ; preds = %bb
tail call void (...) @foo() #0, !dbg !9
tail call void (...) @foo() #0, !dbg !10
tail call void (...) @foo() #0, !dbg !11
br label %bb2, !dbg !18
tail call void (...) @foo() #0, !dbg !24
tail call void (...) @foo() #0, !dbg !24
tail call void (...) @foo() #0, !dbg !24
br label %bb2, !dbg !24
bb2: ; preds = %bb1, %bb
%tmp3 = phi i32 [ 0, %bb1 ], [ 1, %bb ]
ret i32 %tmp3, !dbg !19
ret i32 %tmp3, !dbg !24
}
define i32 @bar_alwaysinline(i32 %arg) local_unnamed_addr #2 !dbg !5 {
define i32 @bar_alwaysinline(i32 %arg) local_unnamed_addr #2 !dbg !25 {
bb:
%tmp = icmp slt i32 %arg, 0, !dbg !7
br i1 %tmp, label %bb1, label %bb2, !dbg !8
%tmp = icmp slt i32 %arg, 0, !dbg !26
br i1 %tmp, label %bb1, label %bb2, !dbg !26
bb1: ; preds = %bb
tail call void (...) @foo() #0, !dbg !9
tail call void (...) @foo() #0, !dbg !10
tail call void (...) @foo() #0, !dbg !11
br label %bb2, !dbg !18
tail call void (...) @foo() #0, !dbg !26
tail call void (...) @foo() #0, !dbg !26
tail call void (...) @foo() #0, !dbg !26
br label %bb2, !dbg !26
bb2: ; preds = %bb1, %bb
%tmp3 = phi i32 [ 0, %bb1 ], [ 1, %bb ]
ret i32 %tmp3, !dbg !19
ret i32 %tmp3, !dbg !26
}
define i32 @bar_cold(i32 %arg) local_unnamed_addr #3 !dbg !5 {
define i32 @bar_cold(i32 %arg) local_unnamed_addr #3 !dbg !27 {
bb:
%tmp = icmp slt i32 %arg, 0, !dbg !7
br i1 %tmp, label %bb1, label %bb2, !dbg !8
%tmp = icmp slt i32 %arg, 0, !dbg !28
br i1 %tmp, label %bb1, label %bb2, !dbg !28
bb1: ; preds = %bb
tail call void (...) @foo() #0, !dbg !9
tail call void (...) @foo() #0, !dbg !10
tail call void (...) @foo() #0, !dbg !11
br label %bb2, !dbg !18
tail call void (...) @foo() #0, !dbg !28
tail call void (...) @foo() #0, !dbg !28
tail call void (...) @foo() #0, !dbg !28
br label %bb2, !dbg !28
bb2: ; preds = %bb1, %bb
%tmp3 = phi i32 [ 0, %bb1 ], [ 1, %bb ]
ret i32 %tmp3, !dbg !19
ret i32 %tmp3, !dbg !28
}
; Function Attrs: nounwind
@ -130,3 +130,9 @@ attributes #3 = { cold nounwind }
!20 = distinct !DISubprogram(name: "dummy_caller", scope: !1, file: !1, line: 19, type: !6, isLocal: false, isDefinition: true, scopeLine: 19, flags: DIFlagPrototyped, isOptimized: true, unit: !0, variables: !2)
!21 = !DILocation(line: 21, column: 11, scope: !20)
!22 = !DILocation(line: 21, column: 4, scope: !20)
!23 = distinct !DISubprogram(name: "bar", scope: !1, file: !1, line: 3, type: !6, isLocal: false, isDefinition: true, scopeLine: 3, flags: DIFlagPrototyped, isOptimized: true, unit: !0, variables: !2)
!24 = !DILocation(line: 4, column: 6, scope: !23)
!25 = distinct !DISubprogram(name: "bar", scope: !1, file: !1, line: 3, type: !6, isLocal: false, isDefinition: true, scopeLine: 3, flags: DIFlagPrototyped, isOptimized: true, unit: !0, variables: !2)
!26 = !DILocation(line: 4, column: 6, scope: !25)
!27 = distinct !DISubprogram(name: "bar", scope: !1, file: !1, line: 3, type: !6, isLocal: false, isDefinition: true, scopeLine: 3, flags: DIFlagPrototyped, isOptimized: true, unit: !0, variables: !2)
!28 = !DILocation(line: 4, column: 6, scope: !27)

View File

@ -37,60 +37,60 @@ entry:
ret void, !dbg !21
}
define void @salvage_bitcast(%struct.entry* %queue) local_unnamed_addr #0 !dbg !14 {
define void @salvage_bitcast(%struct.entry* %queue) local_unnamed_addr #0 !dbg !22 {
entry:
%im_not_dead = alloca i8*
%0 = bitcast %struct.entry* %queue to i8*, !dbg !19
%1 = bitcast %struct.entry* %queue to i8*, !dbg !19
call void @llvm.dbg.value(metadata i8* %1, i64 0, metadata !18, metadata !20), !dbg !19
%0 = bitcast %struct.entry* %queue to i8*, !dbg !23
%1 = bitcast %struct.entry* %queue to i8*, !dbg !23
call void @llvm.dbg.value(metadata i8* %1, i64 0, metadata !24, metadata !20), !dbg !23
; CHECK: define void @salvage_bitcast
; CHECK-NEXT: entry:
; CHECK-NEXT: call void @llvm.dbg.value(metadata %struct.entry* %queue, i64 0,
; CHECK-SAME: metadata ![[BITCAST_EXPR:[0-9]+]])
store i8* %1, i8** %im_not_dead, align 8
ret void, !dbg !21
ret void, !dbg !23
}
define void @salvage_gep0(%struct.entry* %queue, %struct.entry* %end) local_unnamed_addr #0 !dbg !14 {
define void @salvage_gep0(%struct.entry* %queue, %struct.entry* %end) local_unnamed_addr #0 !dbg !25 {
entry:
%im_not_dead = alloca %struct.entry**
%0 = getelementptr inbounds %struct.entry, %struct.entry* %queue, i32 -1, i32 0, !dbg !19
%1 = getelementptr inbounds %struct.entry, %struct.entry* %queue, i32 -1, i32 0, !dbg !19
call void @llvm.dbg.value(metadata %struct.entry** %1, i64 0, metadata !18, metadata !20), !dbg !19
%0 = getelementptr inbounds %struct.entry, %struct.entry* %queue, i32 -1, i32 0, !dbg !26
%1 = getelementptr inbounds %struct.entry, %struct.entry* %queue, i32 -1, i32 0, !dbg !26
call void @llvm.dbg.value(metadata %struct.entry** %1, i64 0, metadata !27, metadata !20), !dbg !26
; CHECK: define void @salvage_gep0
; CHECK-NEXT: entry:
; CHECK-NEXT: call void @llvm.dbg.value(metadata %struct.entry* %queue, i64 0,
; CHECK-SAME: metadata ![[GEP0_EXPR:[0-9]+]])
store %struct.entry** %1, %struct.entry*** %im_not_dead, align 8
ret void, !dbg !21
ret void, !dbg !26
}
define void @salvage_gep1(%struct.entry* %queue, %struct.entry* %end) local_unnamed_addr #0 !dbg !14 {
define void @salvage_gep1(%struct.entry* %queue, %struct.entry* %end) local_unnamed_addr #0 !dbg !28 {
entry:
%im_not_dead = alloca %struct.entry**
%0 = getelementptr inbounds %struct.entry, %struct.entry* %queue, i32 -1, i32 0, !dbg !19
%1 = getelementptr inbounds %struct.entry, %struct.entry* %queue, i32 -1, i32 0, !dbg !19
call void @llvm.dbg.value(metadata %struct.entry** %1, i64 0, metadata !18, metadata !DIExpression(DW_OP_LLVM_fragment, 0, 32)), !dbg !19
%0 = getelementptr inbounds %struct.entry, %struct.entry* %queue, i32 -1, i32 0, !dbg !29
%1 = getelementptr inbounds %struct.entry, %struct.entry* %queue, i32 -1, i32 0, !dbg !29
call void @llvm.dbg.value(metadata %struct.entry** %1, i64 0, metadata !30, metadata !DIExpression(DW_OP_LLVM_fragment, 0, 32)), !dbg !29
; CHECK: define void @salvage_gep1
; CHECK-NEXT: entry:
; CHECK-NEXT: call void @llvm.dbg.value(metadata %struct.entry* %queue, i64 0,
; CHECK-SAME: metadata ![[GEP1_EXPR:[0-9]+]])
store %struct.entry** %1, %struct.entry*** %im_not_dead, align 8
ret void, !dbg !21
ret void, !dbg !29
}
define void @salvage_gep2(%struct.entry* %queue, %struct.entry* %end) local_unnamed_addr #0 !dbg !14 {
define void @salvage_gep2(%struct.entry* %queue, %struct.entry* %end) local_unnamed_addr #0 !dbg !31 {
entry:
%im_not_dead = alloca %struct.entry**
%0 = getelementptr inbounds %struct.entry, %struct.entry* %queue, i32 -1, i32 0, !dbg !19
%1 = getelementptr inbounds %struct.entry, %struct.entry* %queue, i32 -1, i32 0, !dbg !19
call void @llvm.dbg.value(metadata %struct.entry** %1, i64 0, metadata !18, metadata !DIExpression(DW_OP_stack_value)), !dbg !19
%0 = getelementptr inbounds %struct.entry, %struct.entry* %queue, i32 -1, i32 0, !dbg !32
%1 = getelementptr inbounds %struct.entry, %struct.entry* %queue, i32 -1, i32 0, !dbg !32
call void @llvm.dbg.value(metadata %struct.entry** %1, i64 0, metadata !33, metadata !DIExpression(DW_OP_stack_value)), !dbg !32
; CHECK: define void @salvage_gep2
; CHECK-NEXT: entry:
; CHECK-NEXT: call void @llvm.dbg.value(metadata %struct.entry* %queue, i64 0,
; CHECK-SAME: metadata ![[GEP2_EXPR:[0-9]+]])
store %struct.entry** %1, %struct.entry*** %im_not_dead, align 8
ret void, !dbg !21
ret void, !dbg !32
}
; CHECK: ![[LOAD_EXPR]] = !DIExpression(DW_OP_deref, DW_OP_plus, 0)
@ -132,3 +132,15 @@ attributes #1 = { nounwind readnone }
!19 = !DILocation(line: 6, column: 17, scope: !14)
!20 = !DIExpression(DW_OP_plus, 0)
!21 = !DILocation(line: 11, column: 1, scope: !14)
!22 = distinct !DISubprogram(name: "scan", scope: !1, file: !1, line: 4, type: !15, isLocal: false, isDefinition: true, scopeLine: 5, flags: DIFlagPrototyped, isOptimized: true, unit: !0, variables: !17)
!23 = !DILocation(line: 6, column: 17, scope: !22)
!24 = !DILocalVariable(name: "entry", scope: !22, file: !1, line: 6, type: !4)
!25 = distinct !DISubprogram(name: "scan", scope: !1, file: !1, line: 4, type: !15, isLocal: false, isDefinition: true, scopeLine: 5, flags: DIFlagPrototyped, isOptimized: true, unit: !0, variables: !17)
!26 = !DILocation(line: 6, column: 17, scope: !25)
!27 = !DILocalVariable(name: "entry", scope: !25, file: !1, line: 6, type: !4)
!28 = distinct !DISubprogram(name: "scan", scope: !1, file: !1, line: 4, type: !15, isLocal: false, isDefinition: true, scopeLine: 5, flags: DIFlagPrototyped, isOptimized: true, unit: !0, variables: !17)
!29 = !DILocation(line: 6, column: 17, scope: !28)
!30 = !DILocalVariable(name: "entry", scope: !28, file: !1, line: 6, type: !4)
!31 = distinct !DISubprogram(name: "scan", scope: !1, file: !1, line: 4, type: !15, isLocal: false, isDefinition: true, scopeLine: 5, flags: DIFlagPrototyped, isOptimized: true, unit: !0, variables: !17)
!32 = !DILocation(line: 6, column: 17, scope: !31)
!33 = !DILocalVariable(name: "entry", scope: !31, file: !1, line: 6, type: !4)

View File

@ -38,7 +38,7 @@ return: ; preds = %if.end
ret i32 %z.tr, !dbg !17
}
define i32 @tak2(i32 %x, i32 %y, i32 %z) nounwind ssp !dbg !0 {
define i32 @tak2(i32 %x, i32 %y, i32 %z) nounwind ssp !dbg !21 {
; CHECK-LABEL: define i32 @tak2(
; CHECK: entry
; CHECK: tail call void @llvm.dbg.value(metadata i32 %x.tr
@ -51,29 +51,29 @@ tailrecurse: ; preds = %if.then, %entry
%x.tr = phi i32 [ %x, %entry ], [ %call, %if.then ]
%y.tr = phi i32 [ %y, %entry ], [ %call9, %if.then ]
%z.tr = phi i32 [ %z, %entry ], [ %call14, %if.then ]
%cmp = icmp slt i32 %y.tr, %x.tr, !dbg !12
br i1 %cmp, label %if.then, label %if.end, !dbg !12
%cmp = icmp slt i32 %y.tr, %x.tr, !dbg !22
br i1 %cmp, label %if.then, label %if.end, !dbg !22
if.then: ; preds = %tailrecurse
tail call void @llvm.dbg.value(metadata i32 %x.tr, i64 0, metadata !6, metadata !DIExpression()), !dbg !7
tail call void @llvm.dbg.value(metadata i32 %y.tr, i64 0, metadata !8, metadata !DIExpression()), !dbg !9
tail call void @llvm.dbg.value(metadata i32 %z.tr, i64 0, metadata !10, metadata !DIExpression()), !dbg !11
%sub = sub nsw i32 %x.tr, 1, !dbg !14
%call = tail call i32 @tak(i32 %sub, i32 %y.tr, i32 %z.tr), !dbg !14
%sub6 = sub nsw i32 %y.tr, 1, !dbg !14
%call9 = tail call i32 @tak(i32 %sub6, i32 %z.tr, i32 %x.tr), !dbg !14
%sub11 = sub nsw i32 %z.tr, 1, !dbg !14
%call14 = tail call i32 @tak(i32 %sub11, i32 %x.tr, i32 %y.tr), !dbg !14
tail call void @llvm.dbg.value(metadata i32 %x.tr, i64 0, metadata !36, metadata !DIExpression()), !dbg !37
tail call void @llvm.dbg.value(metadata i32 %y.tr, i64 0, metadata !38, metadata !DIExpression()), !dbg !39
tail call void @llvm.dbg.value(metadata i32 %z.tr, i64 0, metadata !40, metadata !DIExpression()), !dbg !41
%sub = sub nsw i32 %x.tr, 1, !dbg !24
%call = tail call i32 @tak(i32 %sub, i32 %y.tr, i32 %z.tr), !dbg !24
%sub6 = sub nsw i32 %y.tr, 1, !dbg !24
%call9 = tail call i32 @tak(i32 %sub6, i32 %z.tr, i32 %x.tr), !dbg !24
%sub11 = sub nsw i32 %z.tr, 1, !dbg !24
%call14 = tail call i32 @tak(i32 %sub11, i32 %x.tr, i32 %y.tr), !dbg !24
br label %tailrecurse
if.end: ; preds = %tailrecurse
tail call void @llvm.dbg.value(metadata i32 %x.tr, i64 0, metadata !6, metadata !DIExpression()), !dbg !7
tail call void @llvm.dbg.value(metadata i32 %y.tr, i64 0, metadata !8, metadata !DIExpression()), !dbg !9
tail call void @llvm.dbg.value(metadata i32 %z.tr, i64 0, metadata !10, metadata !DIExpression()), !dbg !11
br label %return, !dbg !16
tail call void @llvm.dbg.value(metadata i32 %x.tr, i64 0, metadata !36, metadata !DIExpression()), !dbg !37
tail call void @llvm.dbg.value(metadata i32 %y.tr, i64 0, metadata !38, metadata !DIExpression()), !dbg !39
tail call void @llvm.dbg.value(metadata i32 %z.tr, i64 0, metadata !40, metadata !DIExpression()), !dbg !41
br label %return, !dbg !26
return: ; preds = %if.end
ret i32 %z.tr, !dbg !17
ret i32 %z.tr, !dbg !27
}
@channelColumns = external global i64
@ -143,3 +143,16 @@ for.end:
!17 = !DILocation(line: 37, column: 1, scope: !13)
!18 = !DIFile(filename: "/Volumes/Lalgate/cj/llvm/projects/llvm-test/SingleSource/Benchmarks/BenchmarkGame/recursive.c", directory: "/Volumes/Lalgate/cj/D/projects/llvm-test/SingleSource/Benchmarks/BenchmarkGame")
!20 = !{i32 1, !"Debug Info Version", i32 3}
!21 = distinct !DISubprogram(name: "tak", line: 32, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !2, file: !18, scope: !1, type: !3)
!22 = !DILocation(line: 33, column: 3, scope: !23)
!23 = distinct !DILexicalBlock(line: 32, column: 30, file: !18, scope: !21)
!24 = !DILocation(line: 34, column: 5, scope: !25)
!25 = distinct !DILexicalBlock(line: 33, column: 14, file: !18, scope: !23)
!26 = !DILocation(line: 36, column: 3, scope: !23)
!27 = !DILocation(line: 37, column: 1, scope: !23)
!36 = !DILocalVariable(name: "x", line: 32, arg: 1, scope: !21, file: !1, type: !5)
!37 = !DILocation(line: 32, column: 13, scope: !21)
!38 = !DILocalVariable(name: "y", line: 32, arg: 2, scope: !21, file: !1, type: !5)
!39 = !DILocation(line: 32, column: 20, scope: !21)
!40 = !DILocalVariable(name: "z", line: 32, arg: 3, scope: !21, file: !1, type: !5)
!41 = !DILocation(line: 32, column: 27, scope: !21)

View File

@ -1,19 +1,19 @@
test:63067:0
4: 3345 _Z3barv:1398 _Z3foov:2059
1: 3345 _Z3barv:1398 _Z3foov:2059
test_inline:3000:0
5: foo_inline1:3000
1: 3000
5: foo_inline2:4000
1: 4000
1: foo_inline1:3000
11: 3000
1: foo_inline2:4000
19: 4000
test_noinline:3000:0
5: foo_noinline:3000
1: 3000
1: foo_noinline:3000
20: 3000
test_direct:3000:0
5: foo_direct:3000
1: 3000
1: foo_direct:3000
21: 3000
test_inline_strip:3000:0
5: foo_inline_strip:3000
1: foo_inline_strip:3000
1: 3000
test_inline_strip_confilict:3000:0
5: foo_inline_strip_conflict:3000
test_inline_strip_conflict:3000:0
1: foo_inline_strip_conflict:3000
1: 3000

View File

@ -12,7 +12,7 @@ define void @test(void ()*) !dbg !3 {
; CHECK-LABEL: @test_inline
; If the indirect call is promoted and inlined in profile, we should promote and inline it.
define void @test_inline(i64* (i32*)*, i32* %x) !dbg !3 {
define void @test_inline(i64* (i32*)*, i32* %x) !dbg !6 {
%2 = alloca i64* (i32*)*
store i64* (i32*)* %0, i64* (i32*)** %2
%3 = load i64* (i32*)*, i64* (i32*)** %2
@ -25,14 +25,14 @@ define void @test_inline(i64* (i32*)*, i32* %x) !dbg !3 {
; CHECK-NOT: call
; CHECK: if.false.orig_indirect2:
; CHECK: call
call i64* %3(i32* %x), !dbg !5
call i64* %3(i32* %x), !dbg !7
ret void
}
; CHECK-LABEL: @test_inline_strip
; If the indirect call is promoted and inlined in profile, and the callee name
; is stripped we should promote and inline it.
define void @test_inline_strip(i64* (i32*)*, i32* %x) !dbg !3 {
define void @test_inline_strip(i64* (i32*)*, i32* %x) !dbg !8 {
%2 = alloca i64* (i32*)*
store i64* (i32*)* %0, i64* (i32*)** %2
%3 = load i64* (i32*)*, i64* (i32*)** %2
@ -41,74 +41,74 @@ define void @test_inline_strip(i64* (i32*)*, i32* %x) !dbg !3 {
; CHECK-NOT: call
; CHECK: if.false.orig_indirect:
; CHECK: call
call i64* %3(i32* %x), !dbg !5
call i64* %3(i32* %x), !dbg !9
ret void
}
; CHECK-LABEL: @test_inline_strip_conflict
; If the indirect call is promoted and inlined in profile, and the callee name
; is stripped, but have more than 1 potential match, we should not promote.
define void @test_inline_strip_conflict(i64* (i32*)*, i32* %x) !dbg !3 {
define void @test_inline_strip_conflict(i64* (i32*)*, i32* %x) !dbg !10 {
%2 = alloca i64* (i32*)*
store i64* (i32*)* %0, i64* (i32*)** %2
%3 = load i64* (i32*)*, i64* (i32*)** %2
; CHECK-NOT: if.true.direct_targ:
call i64* %3(i32* %x), !dbg !5
call i64* %3(i32* %x), !dbg !11
ret void
}
; CHECK-LABEL: @test_noinline
; If the indirect call target is not available, we should not promote it.
define void @test_noinline(void ()*) !dbg !3 {
define void @test_noinline(void ()*) !dbg !12 {
%2 = alloca void ()*
store void ()* %0, void ()** %2
%3 = load void ()*, void ()** %2
; CHECK-NOT: icmp
; CHECK: call
call void %3(), !dbg !5
call void %3(), !dbg !13
ret void
}
@x = global i32 0, align 4
define i32* @foo_inline1(i32* %x) !dbg !3 {
define i32* @foo_inline1(i32* %x) !dbg !14 {
ret i32* %x
}
define i32* @foo_inline_strip.suffix(i32* %x) !dbg !3 {
define i32* @foo_inline_strip.suffix(i32* %x) !dbg !15 {
ret i32* %x
}
define i32* @foo_inline_strip_conflict.suffix1(i32* %x) !dbg !3 {
define i32* @foo_inline_strip_conflict.suffix1(i32* %x) !dbg !16 {
ret i32* %x
}
define i32* @foo_inline_strip_conflict.suffix2(i32* %x) !dbg !3 {
define i32* @foo_inline_strip_conflict.suffix2(i32* %x) !dbg !17 {
ret i32* %x
}
define i32* @foo_inline_strip_conflict.suffix3(i32* %x) !dbg !3 {
define i32* @foo_inline_strip_conflict.suffix3(i32* %x) !dbg !18 {
ret i32* %x
}
define i32* @foo_inline2(i32* %x) !dbg !3 {
define i32* @foo_inline2(i32* %x) !dbg !19 {
ret i32* %x
}
define i32 @foo_noinline(i32 %x) !dbg !3 {
define i32 @foo_noinline(i32 %x) !dbg !20 {
ret i32 %x
}
define void @foo_direct() !dbg !3 {
define void @foo_direct() !dbg !21 {
ret void
}
; CHECK-LABEL: @test_direct
; We should not promote a direct call.
define void @test_direct() !dbg !3 {
define void @test_direct() !dbg !22 {
; CHECK-NOT: icmp
; CHECK: call
call void @foo_alias(), !dbg !5
call void @foo_alias(), !dbg !23
ret void
}
@ -120,7 +120,25 @@ define void @test_direct() !dbg !3 {
!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1)
!1 = !DIFile(filename: "test.cc", directory: "/")
!2 = !{i32 2, !"Debug Info Version", i32 3}
!3 = distinct !DISubprogram(name: "test", scope: !1, file: !1, line: 1, unit: !0)
!4 = !DILocation(line: 5, scope: !3)
!3 = distinct !DISubprogram(name: "test", scope: !1, file: !1, line: 3, unit: !0)
!4 = !DILocation(line: 4, scope: !3)
!5 = !DILocation(line: 6, scope: !3)
; CHECK: ![[PROF]] = !{!"VP", i32 0, i64 3457, i64 9191153033785521275, i64 2059, i64 -1069303473483922844, i64 1398}
!6 = distinct !DISubprogram(name: "test_inline", scope: !1, file: !1, line: 6, unit: !0)
!7 = !DILocation(line: 7, scope: !6)
!8 = distinct !DISubprogram(name: "test_inline_strip", scope: !1, file: !1, line: 8, unit: !0)
!9 = !DILocation(line: 9, scope: !8)
!10 = distinct !DISubprogram(name: "test_inline_strip_conflict", scope: !1, file: !1, line: 10, unit: !0)
!11 = !DILocation(line: 11, scope: !10)
!12 = distinct !DISubprogram(name: "test_noinline", scope: !1, file: !1, line: 12, unit: !0)
!13 = !DILocation(line: 13, scope: !12)
!14 = distinct !DISubprogram(name: "foo_inline1", scope: !1, file: !1, line: 11, unit: !0)
!15 = distinct !DISubprogram(name: "foo_inline_strip.suffix", scope: !1, file: !1, line: 1, unit: !0)
!16 = distinct !DISubprogram(name: "foo_inline_strip_conflict.suffix1", scope: !1, file: !1, line: 1, unit: !0)
!17 = distinct !DISubprogram(name: "foo_inline_strip_conflict.suffix2", scope: !1, file: !1, line: 1, unit: !0)
!18 = distinct !DISubprogram(name: "foo_inline_strip_conflict.suffix3", scope: !1, file: !1, line: 1, unit: !0)
!19 = distinct !DISubprogram(name: "foo_inline2", scope: !1, file: !1, line: 19, unit: !0)
!20 = distinct !DISubprogram(name: "foo_noinline", scope: !1, file: !1, line: 20, unit: !0)
!21 = distinct !DISubprogram(name: "foo_direct", scope: !1, file: !1, line: 21, unit: !0)
!22 = distinct !DISubprogram(name: "test_direct", scope: !1, file: !1, line: 22, unit: !0)
!23 = !DILocation(line: 23, scope: !22)

View File

@ -1,30 +0,0 @@
; RUN: not llvm-as %s -disable-output 2>&1 | FileCheck %s
; CHECK: function declaration may not have a !dbg attachment
declare !dbg !4 void @f1()
define void @f2() !dbg !4 {
unreachable
}
; CHECK: function must have a single !dbg attachment
define void @f3() !dbg !4 !dbg !4 {
unreachable
}
; CHECK-NOT: !dbg
; CHECK: function !dbg attachment must be a subprogram
; CHECK-NEXT: void ()* @bar
; CHECK-NEXT: !{{[0-9]+}} = !{}
define void @bar() !dbg !6 {
unreachable
}
!llvm.module.flags = !{!0}
!0 = !{i32 2, !"Debug Info Version", i32 3}
!llvm.dbg.cu = !{!1}
!1 = distinct !DICompileUnit(language: DW_LANG_C99, file: !2)
!2 = !DIFile(filename: "t.c", directory: "/path/to/dir")
!4 = distinct !DISubprogram(name: "foo", scope: !1, file: !2, unit: !1)
!6 = !{}