brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.8 KiB · 9585b17 Raw
64 lines · plain
1; RUN: opt %s --passes=inline -o - -S | FileCheck %s --implicit-check-not=dbg_value2 3;; The inliner, specially, hoists all alloca instructions into the entry block4;; of the calling function. Ensure that it doesn't accidentally transfer the5;; dbg.value intrinsic from after the alloca to somewhere else. There should be6;; one dbg.value in the resulting block after the call to ext, and before the7;; call to init.8;;9;; This becomes significant in the context of non-instruction debug-info. When10;; splicing segments of instructions around, it's typically the range from one11;; "real" instruction to another, implicitly including all the dbg.values that12;; come before the ending instruction. The inliner is a (unique!) location in13;; LLVM that builds a range of only a single instruction kind (allocas) and thus14;; doesn't transfer the dbg.value to the entry block. This needs Special15;; Handling once we get rid of debug-intrinsics.16 17; CHECK:    define i32 @bar()18; CHECK-NEXT: %1 = alloca [65 x i32], align 1619; CHECK-NEXT: call void @ext()20; CHECK-NEXT: call void @llvm.lifetime.start.p0(21; CHECK-NEXT: #dbg_value(i32 0, !10, !DIExpression(), !1222; CHECK-NEXT: call void @init(ptr %1)23 24 25declare void @ext()26declare void @init(ptr)27 28define internal i32 @foo() !dbg !4 {29  %1 = alloca [65 x i32], align 1630  call void @llvm.dbg.value(metadata i32 0, metadata !11, metadata !DIExpression()), !dbg !1431  call void @init(ptr %1)32  %2 = load i32, ptr %1, align 433  ret i32 %234}35 36define i32 @bar() !dbg !16 {37  call void @ext()38  %1 = call i32 @foo(), !dbg !1739  ret i32 %140}41 42declare void @llvm.dbg.value(metadata, metadata, metadata)43 44!llvm.dbg.cu = !{!0}45!llvm.module.flags = !{!8, !9}46!llvm.ident = !{!10}47 48!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)49!1 = !DIFile(filename: "a.cc", directory: "/tmp")50!2 = !{}51!4 = distinct !DISubprogram(name: "foo", linkageName: "_Z3fooi", scope: !1, file: !1, line: 3, type: !5, isLocal: false, isDefinition: true, scopeLine: 3, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)52!5 = !DISubroutineType(types: !6)53!6 = !{null, !7}54!7 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)55!8 = !{i32 2, !"Dwarf Version", i32 4}56!9 = !{i32 2, !"Debug Info Version", i32 3}57!10 = !{!"clang"}58!11 = !DILocalVariable(name: "i", arg: 1, scope: !4, file: !1, line: 3, type: !7)59!12 = !DIExpression()60!14 = !DILocation(line: 4, column: 7, scope: !15)61!15 = distinct !DILexicalBlock(scope: !4, file: !1, line: 4, column: 7)62!16 = distinct !DISubprogram(name: "bar", linkageName: "bar", scope: !1, file: !1, line: 3, type: !5, isLocal: false, isDefinition: true, scopeLine: 3, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)63!17 = !DILocation(line: 4, column: 7, scope: !16)64