brintos

brintos / llvm-project-archived public Read only

0
0
Text · 5.1 KiB · bf0dfa2 Raw
121 lines · plain
1; RUN: opt < %s -passes=always-inline -S | FileCheck %s2; RUN: opt -passes='always-inline' -S < %s | FileCheck %s3 4; Original input generated from clang -emit-llvm -S -c -mllvm -disable-llvm-optzns5;6; #define CALLS1 f2(); f2();7; #define CALLS2 f4(); f4();8; void f1();9; inline __attribute__((always_inline)) void f2() {10;   f1();11; }12; inline __attribute__((always_inline)) void f3() {13;   CALLS114; }15; inline __attribute__((always_inline)) void f4() {16;   f3();17; }18; void f() {19;   CALLS220; }21 22; There should be unique locations for all 4 of these instructions, correctly23; describing the inlining that has occurred, even in the face of duplicate call24; site locations.25 26; The nomenclature used for the tags here is <function name>[cs<number>] where27; 'cs' is an abbreviation for 'call site' and the number indicates which call28; site from within the named function this is. (so, given the above inlining, we29; should have 4 calls to 'f1', two from the first call to f4 and two from the30; second call to f4)31 32; CHECK: call void @_Z2f1v(), !dbg [[fcs1_f4_f3cs1_f2:![0-9]+]]33; CHECK: call void @_Z2f1v(), !dbg [[fcs1_f4_f3cs2_f2:![0-9]+]]34; CHECK: call void @_Z2f1v(), !dbg [[fcs2_f4_f3cs1_f2:![0-9]+]]35; CHECK: call void @_Z2f1v(), !dbg [[fcs2_f4_f3cs2_f2:![0-9]+]]36 37; CHECK-DAG: [[F:![0-9]+]]  = distinct !DISubprogram(name: "f"38; CHECK-DAG: [[F2:![0-9]+]] = distinct !DISubprogram(name: "f2"39; CHECK-DAG: [[F3:![0-9]+]] = distinct !DISubprogram(name: "f3"40; CHECK-DAG: [[F4:![0-9]+]] = distinct !DISubprogram(name: "f4"41 42; CHECK-DAG: [[fcs1_f4_f3cs1_f2]] = {{.*}}, scope: [[F2]], inlinedAt: [[fcs1_f4_f3cs1:![0-9]+]])43; CHECK-DAG: [[fcs1_f4_f3cs1]] = {{.*}}, scope: [[F3]], inlinedAt: [[fcs1_f4:![0-9]+]])44; CHECK-DAG: [[fcs1_f4]] = {{.*}}, scope: [[F4]], inlinedAt: [[fcs1:![0-9]+]])45; CHECK-DAG: [[fcs1]] = {{.*}}, scope: [[F]])46; CHECK-DAG: [[fcs1_f4_f3cs2_f2]] = {{.*}}, scope: [[F2]], inlinedAt: [[fcs1_f4_f3cs2:![0-9]+]])47; CHECK-DAG: [[fcs1_f4_f3cs2]] = {{.*}}, scope: [[F3]], inlinedAt: [[fcs1_f4]])48 49; CHECK-DAG: [[fcs2_f4_f3cs1_f2]] = {{.*}}, scope: [[F2]], inlinedAt: [[fcs2_f4_f3cs1:![0-9]+]])50; CHECK-DAG: [[fcs2_f4_f3cs1]] = {{.*}}, scope: [[F3]], inlinedAt: [[fcs2_f4:![0-9]+]])51; CHECK-DAG: [[fcs2_f4]] = {{.*}}, scope: [[F4]], inlinedAt: [[fcs2:![0-9]+]])52; CHECK-DAG: [[fcs2]] = {{.*}}, scope: [[F]])53; CHECK-DAG: [[fcs2_f4_f3cs2_f2]] = {{.*}}, scope: [[F2]], inlinedAt: [[fcs2_f4_f3cs2:![0-9]+]])54; CHECK-DAG: [[fcs2_f4_f3cs2]] = {{.*}}, scope: [[F3]], inlinedAt: [[fcs2_f4]])55 56$_Z2f4v = comdat any57 58$_Z2f3v = comdat any59 60$_Z2f2v = comdat any61 62; Function Attrs: uwtable63define void @_Z1fv() #0 !dbg !4 {64entry:65  call void @_Z2f4v(), !dbg !1366  call void @_Z2f4v(), !dbg !1367  ret void, !dbg !1468}69 70; Function Attrs: alwaysinline inlinehint uwtable71define linkonce_odr void @_Z2f4v() #1 comdat !dbg !7 {72entry:73  call void @_Z2f3v(), !dbg !1574  ret void, !dbg !1675}76 77; Function Attrs: alwaysinline inlinehint uwtable78define linkonce_odr void @_Z2f3v() #1 comdat !dbg !8 {79entry:80  call void @_Z2f2v(), !dbg !1781  call void @_Z2f2v(), !dbg !1782  ret void, !dbg !1883}84 85; Function Attrs: alwaysinline inlinehint uwtable86define linkonce_odr void @_Z2f2v() #1 comdat !dbg !9 {87entry:88  call void @_Z2f1v(), !dbg !1989  ret void, !dbg !2090}91 92attributes #0 = { uwtable }93attributes #1 = { alwaysinline inlinehint uwtable }94 95declare void @_Z2f1v()96 97!llvm.dbg.cu = !{!0}98!llvm.module.flags = !{!10, !11}99!llvm.ident = !{!12}100 101!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.7.0 (trunk 226474) (llvm/trunk 226478)", isOptimized: false, emissionKind: LineTablesOnly, file: !1, enums: !2, retainedTypes: !2, globals: !2, imports: !2)102!1 = !DIFile(filename: "debug-info-duplicate-calls.cpp", directory: "/tmp/dbginfo")103!2 = !{}104!4 = distinct !DISubprogram(name: "f", line: 13, isLocal: false, isDefinition: true, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 13, file: !1, scope: !5, type: !6, retainedNodes: !2)105!5 = !DIFile(filename: "debug-info-duplicate-calls.cpp", directory: "/tmp/dbginfo")106!6 = !DISubroutineType(types: !2)107!7 = distinct !DISubprogram(name: "f4", line: 10, isLocal: false, isDefinition: true, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 10, file: !1, scope: !5, type: !6, retainedNodes: !2)108!8 = distinct !DISubprogram(name: "f3", line: 7, isLocal: false, isDefinition: true, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 7, file: !1, scope: !5, type: !6, retainedNodes: !2)109!9 = distinct !DISubprogram(name: "f2", line: 4, isLocal: false, isDefinition: true, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 4, file: !1, scope: !5, type: !6, retainedNodes: !2)110!10 = !{i32 2, !"Dwarf Version", i32 4}111!11 = !{i32 2, !"Debug Info Version", i32 3}112!12 = !{!"clang version 3.7.0 (trunk 226474) (llvm/trunk 226478)"}113!13 = !DILocation(line: 14, column: 3, scope: !4)114!14 = !DILocation(line: 15, column: 1, scope: !4)115!15 = !DILocation(line: 11, column: 3, scope: !7)116!16 = !DILocation(line: 12, column: 1, scope: !7)117!17 = !DILocation(line: 8, column: 3, scope: !8)118!18 = !DILocation(line: 9, column: 1, scope: !8)119!19 = !DILocation(line: 5, column: 3, scope: !9)120!20 = !DILocation(line: 6, column: 1, scope: !9)121