56 lines · plain
1;; Check that adce salvages debug info properly.2; RUN: opt -passes=adce -S < %s | FileCheck %s3 4; ModuleID = 'test.ll'5source_filename = "test.ll"6 7; Function Attrs: nounwind readnone8declare void @may_not_return(i32) #09 10; Function Attrs: nounwind readnone willreturn11declare void @will_return(i32) #112 13define void @test(i32 %a) !dbg !6 {14; CHECK-LABEL: @test(15; CHECK-NEXT: [[B:%.*]] = add i32 [[A:%.*]], 116; CHECK-NEXT: #dbg_value(i32 [[B]]17; CHECK-NEXT: call void @may_not_return(i32 [[B]])18; CHECK-NEXT: #dbg_value(i32 [[B]], {{.*}}DIExpression(DW_OP_plus_uconst, 1, DW_OP_stack_value)19; CHECK-NEXT: ret void20;21 %b = add i32 %a, 1, !dbg !1222 call void @llvm.dbg.value(metadata i32 %b, metadata !9, metadata !DIExpression()), !dbg !1223 call void @may_not_return(i32 %b), !dbg !1324 %c = add i32 %b, 1, !dbg !1425 call void @llvm.dbg.value(metadata i32 %c, metadata !11, metadata !DIExpression()), !dbg !1426 call void @will_return(i32 %c), !dbg !1527 ret void, !dbg !1628}29 30declare void @llvm.dbg.value(metadata, metadata, metadata)31 32attributes #0 = { nounwind readnone }33attributes #1 = { nounwind readnone willreturn }34 35!llvm.dbg.cu = !{!0}36!llvm.debugify = !{!3, !4}37!llvm.module.flags = !{!5}38 39!0 = distinct !DICompileUnit(language: DW_LANG_C, file: !1, producer: "debugify", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)40!1 = !DIFile(filename: "test.ll", directory: "/")41!2 = !{}42!3 = !{i32 5}43!4 = !{i32 2}44!5 = !{i32 2, !"Debug Info Version", i32 3}45!6 = distinct !DISubprogram(name: "test", linkageName: "test", scope: null, file: !1, line: 1, type: !7, scopeLine: 1, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !8)46!7 = !DISubroutineType(types: !2)47!8 = !{!9, !11}48!9 = !DILocalVariable(name: "1", scope: !6, file: !1, line: 1, type: !10)49!10 = !DIBasicType(name: "ty32", size: 32, encoding: DW_ATE_unsigned)50!11 = !DILocalVariable(name: "2", scope: !6, file: !1, line: 3, type: !10)51!12 = !DILocation(line: 1, column: 1, scope: !6)52!13 = !DILocation(line: 2, column: 1, scope: !6)53!14 = !DILocation(line: 3, column: 1, scope: !6)54!15 = !DILocation(line: 4, column: 1, scope: !6)55!16 = !DILocation(line: 5, column: 1, scope: !6)56