brintos

brintos / llvm-project-archived public Read only

0
0
Text · 10.4 KiB · c0c0cf4 Raw
272 lines · plain
1; RUN: llc < %s -experimental-debug-variable-locations=true | FileCheck %s --check-prefix=ASM2; RUN: llc < %s -filetype=obj -experimental-debug-variable-locations=true | llvm-readobj --codeview - | FileCheck %s --check-prefix=OBJ3 4; Generated from:5; volatile int x;6; int getint(void);7; void putint(int);8; static inline int inlineinc(int a) {9;   int b = a + 1;10;   ++x;11;   return b;12; }13; void f(int p) {14;   if (p) {15;     int a = getint();16;     int b = inlineinc(a);17;     putint(b);18;   } else {19;     int c = getint();20;     putint(c);21;   }22; }23 24; ASM: f:                                      # @f25; ASM: .Lfunc_begin0:26; ASM: # %bb.0:                                 # %entry27; ASM:         #DEBUG_VALUE: f:p <- $ecx28; ASM:         pushq   %rsi29; ASM:         subq    $32, %rsp30; ASM:         movl    %ecx, %esi31; ASM: [[p_ecx_esi:\.Ltmp.*]]:32; ASM:         callq   getint33; ASM: [[after_getint:\.Ltmp.*]]:34; ASM:         testl   %esi, %esi35; ASM:         je      .LBB0_236; ASM: [[after_je:\.Ltmp.*]]:37; ASM: # %bb.1:                                 # %if.then38; ASM-DAG:     #DEBUG_VALUE: inlineinc:a <- $eax39; ASM-DAG:     #DEBUG_VALUE: a <- $eax40; ASM-DAG:     #DEBUG_VALUE: f:p <- $esi41; ASM:         addl    $1, %eax42; ASM: [[after_inc_eax:\.Ltmp.*]]:43; ASM:         #DEBUG_VALUE: inlineinc:b <- $eax44; ASM:         addl    $1, x(%rip)45; ASM: [[after_if:\.Ltmp.*]]:46; ASM: .LBB0_2:                                # %if.else47; ASM:         #DEBUG_VALUE: f:p <- $esi48;; FIXME: tail-merging causes the location of "c" to be dropped in instruction49;; referencing mode.50; ASM:         #DEBUG_VALUE: c <- undef51; ASM:         movl    %eax, %ecx52; ASM:         addq    $32, %rsp53; ASM:         popq    %rsi54; ASM: [[func_end:\.Ltmp.*]]:55; ASM:         jmp     putint                  # TAILCALL56; ASM: [[func_finished:\.Ltmp.*]]:57 58; ASM:         .short  4414                    # Record kind: S_LOCAL59; ASM:         .asciz  "p"60; ASM:         .cv_def_range    .Lfunc_begin0 [[after_getint]], reg, 1861; ASM:         .cv_def_range    [[after_getint]] [[func_end]], reg, 2362; ASM:         .short  4414                    # Record kind: S_LOCAL63; ASM:         .asciz  "c"64; ASM:         .short  4414                    # Record kind: S_LOCAL65; ASM:         .asciz  "a"66; ASM:         .cv_def_range    [[after_je]] [[after_inc_eax]], reg, 1767; ASM:         .short  4414                    # Record kind: S_LOCAL68; ASM:         .asciz  "b"69 70; Note: "b" is a victim of tail de-duplication / branch folding.71 72; ASM:         .short  4429                    # Record kind: S_INLINESITE73; ASM:         .short  4414                    # Record kind: S_LOCAL74; ASM:         .asciz  "a"75; ASM:         .cv_def_range    [[after_je]] [[after_inc_eax]], reg, 1776; ASM:         .short  4414                    # Record kind: S_LOCAL77; ASM:         .asciz  "b"78; ASM:         .cv_def_range    [[after_inc_eax]] [[after_if]], reg, 1779; ASM:         .short  4430                    # Record kind: S_INLINESITE_END80 81; OBJ: Subsection [82; OBJ:   SubSectionType: Symbols (0xF1)83; OBJ:   {{.*}}Proc{{.*}}Sym {84; OBJ:     DisplayName: f85; OBJ:   }86; OBJ:   LocalSym {87; OBJ:     Type: int (0x74)88; OBJ:     Flags [ (0x1)89; OBJ:       IsParameter (0x1)90; OBJ:     ]91; OBJ:     VarName: p92; OBJ:   }93; OBJ:   DefRangeRegisterSym {94; OBJ:     Register: ECX (0x12)95; OBJ:     LocalVariableAddrRange {96; OBJ:       OffsetStart: .text+0x097; OBJ:       ISectStart: 0x098; OBJ:       Range: 0xC99; OBJ:     }100; OBJ:   }101; OBJ:   DefRangeRegisterSym {102; OBJ:     Register: ESI (0x17)103; OBJ:     LocalVariableAddrRange {104; OBJ:       OffsetStart: .text+0xC105; OBJ:       ISectStart: 0x0106; OBJ:       Range: 0x15107; OBJ:     }108; OBJ:   }109; OBJ:   LocalSym {110; OBJ:     Type: int (0x74)111; OBJ:     Flags [ (0x100)112; OBJ:       IsOptimizedOut (0x100)113; OBJ:     ]114; OBJ:     VarName: c115; OBJ:   }116; OBJ:   LocalSym {117; OBJ:     Type: int (0x74)118; OBJ:     Flags [ (0x0)119; OBJ:     ]120; OBJ:     VarName: a121; OBJ:   }122; OBJ:   DefRangeRegisterSym {123; OBJ:     Register: EAX (0x11)124; OBJ:     LocalVariableAddrRange {125; OBJ:       OffsetStart: .text+0x10126; OBJ:       ISectStart: 0x0127; OBJ:       Range: 0x3128; OBJ:     }129; OBJ:   }130; OBJ:   InlineSiteSym {131; OBJ:     PtrParent: 0x0132; OBJ:     PtrEnd: 0x0133; OBJ:     Inlinee: inlineinc (0x1002)134; OBJ:   }135; OBJ:   LocalSym {136; OBJ:     Type: int (0x74)137; OBJ:     Flags [ (0x1)138; OBJ:       IsParameter (0x1)139; OBJ:     ]140; OBJ:     VarName: a141; OBJ:   }142; OBJ:   DefRangeRegisterSym {143; OBJ:     Register: EAX (0x11)144; OBJ:     LocalVariableAddrRange {145; OBJ:       OffsetStart: .text+0x10146; OBJ:       ISectStart: 0x0147; OBJ:       Range: 0x3148; OBJ:     }149; OBJ:   }150; OBJ:   LocalSym {151; OBJ:     Type: int (0x74)152; OBJ:     Flags [ (0x0)153; OBJ:     ]154; OBJ:     VarName: b155; OBJ:   }156; OBJ:   DefRangeRegisterSym {157; OBJ:     Register: EAX (0x11)158; OBJ:     LocalVariableAddrRange {159; OBJ:       OffsetStart: .text+0x13160; OBJ:       ISectStart: 0x0161; OBJ:       Range: 0x7162; OBJ:     }163; OBJ:   }164; OBJ:   InlineSiteEnd {165; OBJ:   }166; OBJ:   ProcEnd167; OBJ: ]168 169; ModuleID = 't.cpp'170source_filename = "test/DebugInfo/COFF/register-variables.ll"171target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"172target triple = "x86_64-pc-windows-msvc18.0.0"173 174@x = internal global i32 0, align 4, !dbg !0175 176; Function Attrs: nounwind uwtable177define void @f(i32 %p) #0 !dbg !12 {178entry:179  tail call void @llvm.dbg.value(metadata i32 %p, metadata !16, metadata !23), !dbg !24180  %tobool = icmp eq i32 %p, 0, !dbg !25181  %call2 = tail call i32 @getint() #3, !dbg !26182  br i1 %tobool, label %if.else, label %if.then, !dbg !27183 184if.then:                                          ; preds = %entry185  tail call void @llvm.dbg.value(metadata i32 %call2, metadata !17, metadata !23), !dbg !28186  tail call void @llvm.dbg.value(metadata i32 %call2, metadata !29, metadata !23), !dbg !35187  %add.i = add nsw i32 %call2, 1, !dbg !37188  tail call void @llvm.dbg.value(metadata i32 %add.i, metadata !34, metadata !23), !dbg !38189  %0 = load volatile i32, ptr @x, align 4, !dbg !39, !tbaa !40190  %inc.i = add nsw i32 %0, 1, !dbg !39191  store volatile i32 %inc.i, ptr @x, align 4, !dbg !39, !tbaa !40192  tail call void @llvm.dbg.value(metadata i32 %add.i, metadata !20, metadata !23), !dbg !44193  tail call void @putint(i32 %add.i) #3, !dbg !45194  br label %if.end, !dbg !46195 196if.else:                                          ; preds = %entry197  tail call void @llvm.dbg.value(metadata i32 %call2, metadata !21, metadata !23), !dbg !47198  tail call void @putint(i32 %call2) #3, !dbg !48199  br label %if.end200 201if.end:                                           ; preds = %if.else, %if.then202  ret void, !dbg !49203}204 205declare i32 @getint() #1206 207declare void @putint(i32) #1208 209; Function Attrs: nounwind readnone210declare void @llvm.dbg.value(metadata, metadata, metadata) #2211 212attributes #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" "tune-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2" "use-soft-float"="false" }213attributes #1 = { "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" }214attributes #2 = { nounwind readnone }215attributes #3 = { nounwind }216 217!llvm.dbg.cu = !{!2}218!llvm.module.flags = !{!8, !9, !10}219!llvm.ident = !{!11}220 221!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())222!1 = !DIGlobalVariable(name: "x", scope: !2, file: !3, line: 1, type: !6, isLocal: false, isDefinition: true)223!2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "clang version 3.9.0 (trunk 260617) (llvm/trunk 260619)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5)224!3 = !DIFile(filename: "t.cpp", directory: "D:\5Csrc\5Cllvm\5Cbuild")225!4 = !{}226!5 = !{!0}227!6 = !DIDerivedType(tag: DW_TAG_volatile_type, baseType: !7)228!7 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)229!8 = !{i32 2, !"CodeView", i32 1}230!9 = !{i32 2, !"Debug Info Version", i32 3}231!10 = !{i32 1, !"PIC Level", i32 2}232!11 = !{!"clang version 3.9.0 (trunk 260617) (llvm/trunk 260619)"}233!12 = distinct !DISubprogram(name: "f", scope: !3, file: !3, line: 9, type: !13, isLocal: false, isDefinition: true, scopeLine: 9, flags: DIFlagPrototyped, isOptimized: true, unit: !2, retainedNodes: !15)234!13 = !DISubroutineType(types: !14)235!14 = !{null, !7}236!15 = !{!16, !17, !20, !21}237!16 = !DILocalVariable(name: "p", arg: 1, scope: !12, file: !3, line: 9, type: !7)238!17 = !DILocalVariable(name: "a", scope: !18, file: !3, line: 11, type: !7)239!18 = distinct !DILexicalBlock(scope: !19, file: !3, line: 10, column: 10)240!19 = distinct !DILexicalBlock(scope: !12, file: !3, line: 10, column: 7)241!20 = !DILocalVariable(name: "b", scope: !18, file: !3, line: 12, type: !7)242!21 = !DILocalVariable(name: "c", scope: !22, file: !3, line: 15, type: !7)243!22 = distinct !DILexicalBlock(scope: !19, file: !3, line: 14, column: 10)244!23 = !DIExpression()245!24 = !DILocation(line: 9, column: 12, scope: !12)246!25 = !DILocation(line: 10, column: 7, scope: !19)247!26 = !DILocation(line: 15, column: 13, scope: !22)248!27 = !DILocation(line: 10, column: 7, scope: !12)249!28 = !DILocation(line: 11, column: 9, scope: !18)250!29 = !DILocalVariable(name: "a", arg: 1, scope: !30, file: !3, line: 4, type: !7)251!30 = distinct !DISubprogram(name: "inlineinc", scope: !3, file: !3, line: 4, type: !31, isLocal: true, isDefinition: true, scopeLine: 4, flags: DIFlagPrototyped, isOptimized: true, unit: !2, retainedNodes: !33)252!31 = !DISubroutineType(types: !32)253!32 = !{!7, !7}254!33 = !{!29, !34}255!34 = !DILocalVariable(name: "b", scope: !30, file: !3, line: 5, type: !7)256!35 = !DILocation(line: 4, column: 33, scope: !30, inlinedAt: !36)257!36 = distinct !DILocation(line: 12, column: 13, scope: !18)258!37 = !DILocation(line: 5, column: 13, scope: !30, inlinedAt: !36)259!38 = !DILocation(line: 5, column: 7, scope: !30, inlinedAt: !36)260!39 = !DILocation(line: 6, column: 3, scope: !30, inlinedAt: !36)261!40 = !{!41, !41, i64 0}262!41 = !{!"int", !42, i64 0}263!42 = !{!"omnipotent char", !43, i64 0}264!43 = !{!"Simple C/C++ TBAA"}265!44 = !DILocation(line: 12, column: 9, scope: !18)266!45 = !DILocation(line: 13, column: 5, scope: !18)267!46 = !DILocation(line: 14, column: 3, scope: !18)268!47 = !DILocation(line: 15, column: 9, scope: !22)269!48 = !DILocation(line: 16, column: 5, scope: !22)270!49 = !DILocation(line: 18, column: 1, scope: !12)271 272