brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.5 KiB · e298088 Raw
100 lines · plain
1; RUN: opt < %s -passes=inline -S | FileCheck %s2 3; This tests that functions with the attribute `no-inline-line-tables` have the4; correct debug information when they are inlined.5 6; ModuleID = 't.c'7source_filename = "t.c"8target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"9target triple = "x86_64-unknown-windows-msvc"10 11; Function Attrs: alwaysinline nounwind12define dso_local i32 @f(i32 %x) #0 !dbg !7 {13entry:14  %x.addr = alloca i32, align 415  store i32 %x, ptr %x.addr, align 416  call void @llvm.dbg.declare(metadata ptr %x.addr, metadata !12, metadata !DIExpression()), !dbg !1317  %0 = load i32, ptr %x.addr, align 4, !dbg !1418  ret i32 %0, !dbg !1419}20 21; Function Attrs: nounwind readnone speculatable willreturn22declare void @llvm.dbg.declare(metadata, metadata, metadata) #123 24; Function Attrs: alwaysinline nounwind25define i32 @g(i32 %x) #0 !dbg !15 {26entry:27  %x.addr = alloca i32, align 428  store i32 %x, ptr %x.addr, align 429  call void @llvm.dbg.declare(metadata ptr %x.addr, metadata !16, metadata !DIExpression()), !dbg !1730  br label %L, !dbg !1731 32L:                                                ; preds = %entry33  call void @llvm.dbg.label(metadata !18), !dbg !1934  store i32 42, ptr %x.addr, align 4, !dbg !2035  %0 = load i32, ptr %x.addr, align 4, !dbg !2136  ret i32 %0, !dbg !2137}38 39; Function Attrs: nounwind readnone speculatable willreturn40declare void @llvm.dbg.label(metadata) #141 42; Check that debug info for inlined code uses the call location and that debug43; intrinsics are removed.44; Function Attrs: noinline nounwind optnone45define i32 @main() #2 !dbg !22 {46entry:47; CHECK-LABEL: @main()48; CHECK-NOT: @f49; CHECK-NOT: @llvm.dbg.declare50; CHECK: %{{[0-9]+}} = load i32, ptr %x.addr.i, align 4, !dbg ![[VAR1:[0-9]+]]51  %call = call i32 @f(i32 3), !dbg !2552 53; Another test for inlining debug intrinsics where the intrinsic appears at the54; start of the basic block.55; CHECK-NOT: @g56; CHECK-NOT: @llvm.dbg.label57; CHECK: %{{[0-9]+}} = load i32, ptr %x.addr.i1, align 4, !dbg ![[VAR2:[0-9]+]]58  %call1 = call i32 @g(i32 340), !dbg !2659  ret i32 0, !dbg !2760}61 62; CHECK: ![[VAR1]] = !DILocation(line: 10, scope: ![[SCOPE:[0-9]+]])63; CHECK: ![[VAR2]] = !DILocation(line: 11, scope: ![[SCOPE]])64 65attributes #0 = { alwaysinline nounwind "no-inline-line-tables" }66attributes #2 = { noinline nounwind optnone "no-inline-line-tables"}67 68!llvm.dbg.cu = !{!0}69!llvm.module.flags = !{!3, !4, !5}70!llvm.ident = !{!6}71 72!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 10.0.0 (https://github.com/llvm/llvm-project.git 03ec3a12a94bbbaa11999b6da3a43221a5aa54a5)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, nameTableKind: None)73!1 = !DIFile(filename: "<stdin>", directory: "/usr/local/google/home/akhuang/testing/inline-line-tables", checksumkind: CSK_MD5, checksum: "38a4785b48742d3ea655b8f3461436a4")74!2 = !{}75!3 = !{i32 2, !"CodeView", i32 1}76!4 = !{i32 2, !"Debug Info Version", i32 3}77!5 = !{i32 1, !"wchar_size", i32 4}78!6 = !{!"clang version 10.0.0 (https://github.com/llvm/llvm-project.git 03ec3a12a94bbbaa11999b6da3a43221a5aa54a5)"}79!7 = distinct !DISubprogram(name: "f", scope: !8, file: !8, line: 1, type: !9, scopeLine: 1, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2)80!8 = !DIFile(filename: "t.c", directory: "/usr/local/google/home/akhuang/testing/inline-line-tables", checksumkind: CSK_MD5, checksum: "38a4785b48742d3ea655b8f3461436a4")81!9 = !DISubroutineType(types: !10)82!10 = !{!11, !11}83!11 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)84!12 = !DILocalVariable(name: "x", arg: 1, scope: !7, file: !8, line: 1, type: !11)85!13 = !DILocation(line: 1, scope: !7)86!14 = !DILocation(line: 2, scope: !7)87!15 = distinct !DISubprogram(name: "g", scope: !8, file: !8, line: 4, type: !9, scopeLine: 4, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2)88!16 = !DILocalVariable(name: "x", arg: 1, scope: !15, file: !8, line: 4, type: !11)89!17 = !DILocation(line: 4, scope: !15)90!18 = !DILabel(scope: !15, name: "L", file: !8, line: 5)91!19 = !DILocation(line: 5, scope: !15)92!20 = !DILocation(line: 6, scope: !15)93!21 = !DILocation(line: 7, scope: !15)94!22 = distinct !DISubprogram(name: "main", scope: !8, file: !8, line: 9, type: !23, scopeLine: 9, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2)95!23 = !DISubroutineType(types: !24)96!24 = !{!11}97!25 = !DILocation(line: 10, scope: !22)98!26 = !DILocation(line: 11, scope: !22)99!27 = !DILocation(line: 12, scope: !22)100