brintos

brintos / llvm-project-archived public Read only

0
0
Text · 7.8 KiB · 1de1d0b Raw
204 lines · plain
1; RUN: llc -O0 < %s | FileCheck %s --check-prefix=CHECK --check-prefix=DEBUG2; RUN: llc < %s | FileCheck %s3; RUN: llc -filetype=obj -O0 < %s | llvm-readobj --codeview - | FileCheck %s --check-prefix=OBJ4 5; IR generated by the following source:6; struct NonTrivial {7;   NonTrivial();// : x(42) {}8;   ~NonTrivial();// {}9;   int x;10; };11; extern "C" void g(int);// {}12; extern "C" void h(int);// {}13; extern "C" void f(NonTrivial a, int b, int unused, int c) {14;   if (b) {15;     g(c);16;   } else {17;     h(a.x);18;   }19;   (void)unused;20; }21; //int main() {22; //  NonTrivial x;23; //  f(x, 1, 2, 3);24; //}25;26; Remove C++ comments to have a complete, debuggable program.27 28; We don't need (or want) DBG_VALUE instructions to describe the location of29; inalloca arguments. We want frame indices in the side table, especially at30; -O0, because they are reliable across the entire function and don't require31; any propagation or analysis.32 33; CHECK: _f:                                     # @f34; CHECK: Lfunc_begin0:35; CHECK-NOT: DEBUG_VALUE36; CHECK: [[start:Ltmp[0-9]+]]:37; CHECK-NOT: DEBUG_VALUE38; CHECK:         cmpl39; CHECK:         calll   _g40; CHECK:         calll   _h41; CHECK:         jmp "??1NonTrivial@@QAE@XZ"42; CHECK: [[end:Ltmp[0-9]+]]:43; CHECK: Lfunc_end0:44 45; FIXME: Optimized debug info should preserve this.46; DEBUG:         .short  4414                    # Record kind: S_LOCAL47; DEBUG:         .asciz  "a"48; DEBUG:         .cv_def_range    [[start]] [[end]]49 50; CHECK:         .short  4414                    # Record kind: S_LOCAL51; CHECK:         .asciz  "b"52; CHECK:         .cv_def_range    [[start]] [[end]]53 54; CHECK:         .short  4414                    # Record kind: S_LOCAL55; CHECK:         .asciz  "c"56; CHECK:         .cv_def_range    [[start]] [[end]]57 58; OBJ-LABEL: {{.*}}Proc{{.*}}Sym {59; OBJ:   Kind: S_GPROC32_ID (0x1147)60; OBJ:   DisplayName: f61; OBJ: }62; OBJ: FrameProcSym {63; OBJ:   Kind: S_FRAMEPROC (0x1012)64; OBJ:   TotalFrameBytes: 0x865; OBJ:   LocalFramePtrReg: VFRAME (0x7536)66; OBJ:   ParamFramePtrReg: VFRAME (0x7536)67; OBJ: }68; OBJ: LocalSym {69; OBJ:   Kind: S_LOCAL (0x113E)70; OBJ:   Type: NonTrivial (0x{{.*}})71; OBJ:   Flags [ (0x1)72; OBJ:     IsParameter (0x1)73; OBJ:   ]74; OBJ:   VarName: a75; OBJ: }76; OBJ: DefRangeFramePointerRelSym {77; OBJ:   Offset: 478; OBJ: }79; OBJ: LocalSym {80; OBJ:   Type: int (0x74)81; OBJ:   Flags [ (0x1)82; OBJ:     IsParameter (0x1)83; OBJ:   ]84; OBJ:   VarName: b85; OBJ: }86; OBJ: DefRangeFramePointerRelSym {87; OBJ:   Offset: 888; OBJ: }89; FIXME: Retain unused.90; OBJ: LocalSym {91; OBJ:   Type: int (0x74)92; OBJ:   Flags [ (0x1)93; OBJ:     IsParameter (0x1)94; OBJ:   ]95; OBJ:   VarName: c96; OBJ: }97; OBJ: DefRangeFramePointerRelSym {98; OBJ:   Offset: 1699; OBJ: }100; OBJ-LABEL: ProcEnd {101; OBJ: }102 103 104; ModuleID = 't.cpp'105source_filename = "t.cpp"106target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32"107target triple = "i386-pc-windows-msvc19.10.24728"108 109%struct.NonTrivial = type { i32 }110 111; Function Attrs: nounwind112define void @f(ptr inalloca(<{ %struct.NonTrivial, i32, i32, i32 }>)) local_unnamed_addr #0 !dbg !7 {113entry:114  %a = getelementptr inbounds <{ %struct.NonTrivial, i32, i32, i32 }>, ptr %0, i32 0, i32 0115  %b = getelementptr inbounds <{ %struct.NonTrivial, i32, i32, i32 }>, ptr %0, i32 0, i32 1116  call void @llvm.dbg.declare(metadata ptr %b, metadata !22, metadata !24), !dbg !26117  call void @llvm.dbg.declare(metadata ptr %a, metadata !23, metadata !24), !dbg !27118  %1 = load i32, ptr %b, align 4, !dbg !28, !tbaa !30119  %tobool = icmp eq i32 %1, 0, !dbg !28120  br i1 %tobool, label %if.else, label %if.then, !dbg !34121 122if.then:                                          ; preds = %entry123  %c = getelementptr inbounds <{ %struct.NonTrivial, i32, i32, i32 }>, ptr %0, i32 0, i32 3124  call void @llvm.dbg.declare(metadata ptr %c, metadata !20, metadata !24), !dbg !25125  %2 = load i32, ptr %c, align 4, !dbg !35, !tbaa !30126  tail call void @g(i32 %2) #4, !dbg !37127  br label %if.end, !dbg !38128 129if.else:                                          ; preds = %entry130  %x = getelementptr inbounds <{ %struct.NonTrivial, i32, i32, i32 }>, ptr %0, i32 0, i32 0, i32 0, !dbg !39131  %3 = load i32, ptr %x, align 4, !dbg !39, !tbaa !41132  tail call void @h(i32 %3) #4, !dbg !43133  br label %if.end134 135if.end:                                           ; preds = %if.else, %if.then136  tail call x86_thiscallcc void @"\01??1NonTrivial@@QAE@XZ"(ptr nonnull %a) #4, !dbg !44137  ret void, !dbg !44138}139 140; Function Attrs: nounwind readnone speculatable141declare void @llvm.dbg.declare(metadata, metadata, metadata) #1142 143declare void @g(i32) local_unnamed_addr144 145declare void @h(i32) local_unnamed_addr146 147; Function Attrs: nounwind148declare x86_thiscallcc void @"\01??1NonTrivial@@QAE@XZ"(ptr) unnamed_addr #3149 150attributes #0 = { nounwind }151attributes #1 = { nounwind readnone speculatable }152attributes #3 = { nounwind }153attributes #4 = { nounwind }154 155!llvm.dbg.cu = !{!0}156!llvm.module.flags = !{!3, !4, !5}157!llvm.ident = !{!6}158 159!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 5.0.0 ", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)160!1 = !DIFile(filename: "t.cpp", directory: "C:\5Csrc\5Cllvm-project\5Cbuild", checksumkind: CSK_MD5, checksum: "e41e3fda2a91b52e121ed6c29a209eae")161!2 = !{}162!3 = !{i32 1, !"NumRegisterParameters", i32 0}163!4 = !{i32 2, !"CodeView", i32 1}164!5 = !{i32 2, !"Debug Info Version", i32 3}165!6 = !{!"clang version 5.0.0 "}166!7 = distinct !DISubprogram(name: "f", scope: !1, file: !1, line: 8, type: !8, isLocal: false, isDefinition: true, scopeLine: 8, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !19)167!8 = !DISubroutineType(types: !9)168!9 = !{null, !10, !13, !13, !13}169!10 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "NonTrivial", file: !1, line: 1, size: 32, elements: !11, identifier: ".?AUNonTrivial@@")170!11 = !{!12, !14, !18}171!12 = !DIDerivedType(tag: DW_TAG_member, name: "x", scope: !10, file: !1, line: 4, baseType: !13, size: 32)172!13 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)173!14 = !DISubprogram(name: "NonTrivial", scope: !10, file: !1, line: 2, type: !15, isLocal: false, isDefinition: false, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: true)174!15 = !DISubroutineType(cc: DW_CC_BORLAND_thiscall, types: !16)175!16 = !{null, !17}176!17 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !10, size: 32, flags: DIFlagArtificial | DIFlagObjectPointer)177!18 = !DISubprogram(name: "~NonTrivial", scope: !10, file: !1, line: 3, type: !15, isLocal: false, isDefinition: false, scopeLine: 3, flags: DIFlagPrototyped, isOptimized: true)178!19 = !{!20, !21, !22, !23}179!20 = !DILocalVariable(name: "c", arg: 4, scope: !7, file: !1, line: 8, type: !13)180!21 = !DILocalVariable(name: "unused", arg: 3, scope: !7, file: !1, line: 8, type: !13)181!22 = !DILocalVariable(name: "b", arg: 2, scope: !7, file: !1, line: 8, type: !13)182!23 = !DILocalVariable(name: "a", arg: 1, scope: !7, file: !1, line: 8, type: !10)183!24 = !DIExpression()184!25 = !DILocation(line: 8, column: 56, scope: !7)185!26 = !DILocation(line: 8, column: 37, scope: !7)186!27 = !DILocation(line: 8, column: 30, scope: !7)187!28 = !DILocation(line: 9, column: 7, scope: !29)188!29 = distinct !DILexicalBlock(scope: !7, file: !1, line: 9, column: 7)189!30 = !{!31, !31, i64 0}190!31 = !{!"int", !32, i64 0}191!32 = !{!"omnipotent char", !33, i64 0}192!33 = !{!"Simple C++ TBAA"}193!34 = !DILocation(line: 9, column: 7, scope: !7)194!35 = !DILocation(line: 10, column: 7, scope: !36)195!36 = distinct !DILexicalBlock(scope: !29, file: !1, line: 9, column: 10)196!37 = !DILocation(line: 10, column: 5, scope: !36)197!38 = !DILocation(line: 11, column: 3, scope: !36)198!39 = !DILocation(line: 12, column: 9, scope: !40)199!40 = distinct !DILexicalBlock(scope: !29, file: !1, line: 11, column: 10)200!41 = !{!42, !31, i64 0}201!42 = !{!"?AUNonTrivial@@", !31, i64 0}202!43 = !DILocation(line: 12, column: 5, scope: !40)203!44 = !DILocation(line: 15, column: 1, scope: !7)204