68 lines · plain
1; RUN: opt -passes=deadargelim -S < %s | FileCheck %s2 3; Verify that the dbg.value intrinsics that use the dead argument and return4; value are marked as poison to indicate that the values are optimized out.5 6; Reproducer for PR23260.7 8; CHECK-LABEL: define internal void @bar()9; CHECK: #dbg_value(i32 poison, ![[LOCAL1:[0-9]+]]10; CHECK: call void @sink()11 12; Function Attrs: alwaysinline nounwind uwtable13define internal i32 @bar(i32 %deadarg) #1 !dbg !10 {14entry:15 call void @llvm.dbg.value(metadata i32 %deadarg, metadata !15, metadata !DIExpression()), !dbg !1716 call void @sink(), !dbg !1717 ret i32 123, !dbg !1718}19 20; CHECK-LABEL: define void @foo()21; CHECK: call void @bar()22; CHECK: #dbg_value(i32 poison, ![[LOCAL2:[0-9]+]]23; CHECK: call void @bar()24 25; Function Attrs: nounwind uwtable26define void @foo() #0 !dbg !6 {27entry:28 %deadret = call i32 @bar(i32 0), !dbg !929 call void @llvm.dbg.value(metadata i32 %deadret, metadata !16, metadata !DIExpression()), !dbg !930 call i32 @bar(i32 1), !dbg !931 ret void, !dbg !932}33 34declare void @sink() local_unnamed_addr35 36; Function Attrs: nounwind readnone speculatable37declare void @llvm.dbg.value(metadata, metadata, metadata) #238 39attributes #0 = { nounwind uwtable }40attributes #1 = { alwaysinline nounwind uwtable }41attributes #2 = { nounwind readnone speculatable }42 43!llvm.dbg.cu = !{!0}44!llvm.module.flags = !{!3, !4}45!llvm.ident = !{!5}46 47; CHECK: ![[LOCAL1]] = !DILocalVariable(name: "local1"48; CHECK: ![[LOCAL2]] = !DILocalVariable(name: "local2"49 50!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 8.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, nameTableKind: None)51!1 = !DIFile(filename: "pr23260.c", directory: "/")52!2 = !{}53!3 = !{i32 2, !"Dwarf Version", i32 4}54!4 = !{i32 2, !"Debug Info Version", i32 3}55!5 = !{!"clang version 8.0.0"}56!6 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 3, type: !7, scopeLine: 3, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !2)57!7 = !DISubroutineType(types: !8)58!8 = !{null}59!9 = !DILocation(line: 4, column: 3, scope: !6)60!10 = distinct !DISubprogram(name: "bar", scope: !1, file: !1, line: 2, type: !11, scopeLine: 2, flags: DIFlagPrototyped, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !14)61!11 = !DISubroutineType(types: !12)62!12 = !{!13, !13}63!13 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)64!14 = !{!15}65!15 = !DILocalVariable(name: "local1", arg: 1, scope: !10, file: !1, line: 2, type: !13)66!16 = !DILocalVariable(name: "local2", arg: 1, scope: !6, file: !1, line: 2, type: !13)67!17 = !DILocation(line: 2, column: 52, scope: !10)68