123 lines · plain
1; RUN: llc -mtriple=x86_64-linux-gnueabi < %s | FileCheck %s2; RUN: opt -passes=strip -S < %s | llc -mtriple=x86_64-linux-gnueabi | FileCheck %s3 4; This test checks if the code is generated correctly with and without debug info.5 6; This LL file was generated by running 'clang -g -gcodeview' on the7; following code:8; 1: extern "C" volatile int x;9; 2: extern "C" void capture(int *p);10; 3: static __forceinline inline void will_be_inlined() {11; 4: int v = 3;12; 5: capture(&v);13; 6: }14; 7: extern "C" void f(int param) {15; 8: if (param) {16; 9: int a = 42;17; 10: will_be_inlined();18; 11: capture(&a);19; 12: } else {20; 13: int b = 42;21; 14: will_be_inlined();22; 15: capture(&b);23; 16: }24; 17: }25 26; ModuleID = 't.cpp'27 28; Function Attrs: nounwind uwtable29define void @f(i32 %param) #0 !dbg !4 {30entry:31 %v.i1 = alloca i32, align 432 call void @llvm.dbg.declare(metadata ptr %v.i1, metadata !15, metadata !16), !dbg !1733 %v.i = alloca i32, align 434 call void @llvm.dbg.declare(metadata ptr %v.i, metadata !15, metadata !16), !dbg !2135 %param.addr = alloca i32, align 436 %a = alloca i32, align 437 %b = alloca i32, align 438 store i32 %param, ptr %param.addr, align 439 call void @llvm.dbg.declare(metadata ptr %param.addr, metadata !24, metadata !16), !dbg !2540 %0 = load i32, ptr %param.addr, align 4, !dbg !2641 %tobool = icmp ne i32 %0, 0, !dbg !2642 br i1 %tobool, label %if.then, label %if.else, !dbg !2743 44;CHECK: movl [[REG:.*]], 20(%rsp)45;CHECK: je [[LABEL:.*]]46 47if.then: ; preds = %entry48 call void @llvm.dbg.declare(metadata ptr %a, metadata !28, metadata !16), !dbg !2949 store i32 42, ptr %a, align 4, !dbg !2950 store i32 3, ptr %v.i, align 4, !dbg !2151 call void @capture(ptr %v.i) #3, !dbg !3052 call void @capture(ptr %a), !dbg !3153 br label %if.end, !dbg !3254 55;CHECK: movl $3, 12(%rsp)56 57if.else: ; preds = %entry58 call void @llvm.dbg.declare(metadata ptr %b, metadata !33, metadata !16), !dbg !3459 store i32 42, ptr %b, align 4, !dbg !3460 store i32 3, ptr %v.i1, align 4, !dbg !1761 call void @capture(ptr %v.i1) #3, !dbg !3562 call void @capture(ptr %b), !dbg !3663 br label %if.end64 65;CHECK: [[LABEL]]:66;CHECK: movl $3, 16(%rsp)67 68if.end: ; preds = %if.else, %if.then69 ret void, !dbg !3770}71 72; Function Attrs: nounwind readnone73declare void @llvm.dbg.declare(metadata, metadata, metadata) #174 75declare void @capture(ptr) #276 77attributes #0 = { nounwind uwtable "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2" "use-soft-float"="false" }78attributes #1 = { nounwind readnone }79attributes #2 = { "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2" "use-soft-float"="false" }80attributes #3 = { nounwind }81 82!llvm.dbg.cu = !{!0}83!llvm.module.flags = !{!11, !12, !13}84!llvm.ident = !{!14}85 86!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 3.9.0 ", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)87!1 = !DIFile(filename: "t.cpp", directory: "D:\5Csrc\5Cllvm\5Cbuild")88!2 = !{}89!4 = distinct !DISubprogram(name: "f", scope: !1, file: !1, line: 7, type: !5, isLocal: false, isDefinition: true, scopeLine: 7, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)90!5 = !DISubroutineType(types: !6)91!6 = !{null, !7}92!7 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)93!8 = distinct !DISubprogram(name: "will_be_inlined", linkageName: "\01?will_be_inlined@@YAXXZ", scope: !1, file: !1, line: 3, type: !9, isLocal: true, isDefinition: true, scopeLine: 3, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)94!9 = !DISubroutineType(types: !10)95!10 = !{null}96!11 = !{i32 2, !"CodeView", i32 1}97!12 = !{i32 2, !"Debug Info Version", i32 3}98!13 = !{i32 1, !"PIC Level", i32 2}99!14 = !{!"clang version 3.9.0 "}100!15 = !DILocalVariable(name: "v", scope: !8, file: !1, line: 4, type: !7)101!16 = !DIExpression()102!17 = !DILocation(line: 4, column: 7, scope: !8, inlinedAt: !18)103!18 = distinct !DILocation(line: 14, column: 5, scope: !19)104!19 = distinct !DILexicalBlock(scope: !20, file: !1, line: 12, column: 10)105!20 = distinct !DILexicalBlock(scope: !4, file: !1, line: 8, column: 7)106!21 = !DILocation(line: 4, column: 7, scope: !8, inlinedAt: !22)107!22 = distinct !DILocation(line: 10, column: 5, scope: !23)108!23 = distinct !DILexicalBlock(scope: !20, file: !1, line: 8, column: 14)109!24 = !DILocalVariable(name: "param", arg: 1, scope: !4, file: !1, line: 7, type: !7)110!25 = !DILocation(line: 7, column: 23, scope: !4)111!26 = !DILocation(line: 8, column: 7, scope: !20)112!27 = !DILocation(line: 8, column: 7, scope: !4)113!28 = !DILocalVariable(name: "a", scope: !23, file: !1, line: 9, type: !7)114!29 = !DILocation(line: 9, column: 9, scope: !23)115!30 = !DILocation(line: 5, column: 3, scope: !8, inlinedAt: !22)116!31 = !DILocation(line: 11, column: 5, scope: !23)117!32 = !DILocation(line: 12, column: 3, scope: !23)118!33 = !DILocalVariable(name: "b", scope: !19, file: !1, line: 13, type: !7)119!34 = !DILocation(line: 13, column: 9, scope: !19)120!35 = !DILocation(line: 5, column: 3, scope: !8, inlinedAt: !18)121!36 = !DILocation(line: 15, column: 5, scope: !19)122!37 = !DILocation(line: 17, column: 1, scope: !4)123