brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.8 KiB · b7063b8 Raw
99 lines · plain
1; RUN: opt < %s -S -passes=inline | FileCheck %s2; RUN: opt < %s -S -passes='cgscc(inline)' | FileCheck %s3;4; The purpose of this test is to check that inline pass preserves debug info5; for variable using the dbg.declare intrinsic.6;7;; This test was generated by running this command:8;; clang.exe -S -O0 -emit-llvm -g foo.c9;;10;; foo.c11;; ==========================12;; float foo(float x)13;; {14;;    return x;15;; }16;;17;; void bar(ptr dst)18;; {19;;    dst[0] = foo(dst[0]);20;; }21;; ==========================22 23target datalayout = "e-m:w-p:32:32-i64:64-f80:32-n8:16:32-S32"24target triple = "i686-pc-windows-msvc"25 26; Function Attrs: nounwind27define float @foo(float %x) #0 !dbg !4 {28entry:29  %x.addr = alloca float, align 430  store float %x, ptr %x.addr, align 431  call void @llvm.dbg.declare(metadata ptr %x.addr, metadata !16, metadata !17), !dbg !1832  %0 = load float, ptr %x.addr, align 4, !dbg !1933  ret float %0, !dbg !1934}35 36; Function Attrs: nounwind readnone37declare void @llvm.dbg.declare(metadata, metadata, metadata) #138 39; CHECK: define void @bar40 41; Function Attrs: nounwind42define void @bar(ptr %dst) #0 !dbg !9 {43entry:44 45; CHECK: [[x_addr_i:%.+]] = alloca float, align 446; CHECK: store float {{.*}}, ptr [[x_addr_i]]47; CHECK-NEXT: #dbg_declare(ptr [[x_addr_i]], [[m23:![0-9]+]], !DIExpression(), [[m24:![0-9]+]]48 49  %dst.addr = alloca ptr, align 450  store ptr %dst, ptr %dst.addr, align 451  call void @llvm.dbg.declare(metadata ptr %dst.addr, metadata !20, metadata !17), !dbg !2152  %0 = load ptr, ptr %dst.addr, align 4, !dbg !2253  %1 = load float, ptr %0, align 4, !dbg !2254  %call = call float @foo(float %1), !dbg !2255 56; CHECK-NOT: call float @foo57 58  %2 = load ptr, ptr %dst.addr, align 4, !dbg !2259  store float %call, ptr %2, align 4, !dbg !2260  ret void, !dbg !2361}62 63attributes #0 = { nounwind }64attributes #1 = { nounwind readnone }65 66!llvm.dbg.cu = !{!0}67!llvm.module.flags = !{!13, !14}68!llvm.ident = !{!15}69 70!0 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang version 3.6.0 (trunk)", isOptimized: false, emissionKind: FullDebug, file: !1, enums: !2, retainedTypes: !2, globals: !2, imports: !2)71!1 = !DIFile(filename: "foo.c", directory: "")72!2 = !{}73!4 = distinct !DISubprogram(name: "foo", line: 1, isLocal: false, isDefinition: true, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 2, file: !1, scope: !5, type: !6, retainedNodes: !2)74!5 = !DIFile(filename: "foo.c", directory: "")75!6 = !DISubroutineType(types: !7)76!7 = !{!8, !8}77!8 = !DIBasicType(tag: DW_TAG_base_type, name: "float", size: 32, align: 32, encoding: DW_ATE_float)78!9 = distinct !DISubprogram(name: "bar", line: 6, isLocal: false, isDefinition: true, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 7, file: !1, scope: !5, type: !10, retainedNodes: !2)79!10 = !DISubroutineType(types: !11)80!11 = !{null, !12}81!12 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 32, align: 32, baseType: !8)82!13 = !{i32 2, !"Dwarf Version", i32 4}83!14 = !{i32 2, !"Debug Info Version", i32 3}84!15 = !{!"clang version 3.6.0 (trunk)"}85!16 = !DILocalVariable(name: "x", line: 1, arg: 1, scope: !4, file: !5, type: !8)86!17 = !DIExpression()87!18 = !DILocation(line: 1, column: 17, scope: !4)88!19 = !DILocation(line: 3, column: 5, scope: !4)89!20 = !DILocalVariable(name: "dst", line: 6, arg: 1, scope: !9, file: !5, type: !12)90!21 = !DILocation(line: 6, column: 17, scope: !9)91!22 = !DILocation(line: 8, column: 14, scope: !9)92!23 = !DILocation(line: 9, column: 1, scope: !9)93 94; CHECK: [[FOO:![0-9]+]] = distinct !DISubprogram(name: "foo",95; CHECK: [[m23]] = !DILocalVariable(name: "x", arg: 1, scope: [[FOO]]96; CHECK: [[BAR:![0-9]+]] = distinct !DISubprogram(name: "bar",97; CHECK: [[m24]] = !DILocation(line: 1, column: 17, scope: [[FOO]], inlinedAt: [[CALL_SITE:![0-9]+]])98; CHECK: [[CALL_SITE]] = distinct !DILocation(line: 8, column: 14, scope: [[BAR]])99