brintos

brintos / llvm-project-archived public Read only

0
0
Text · 5.5 KiB · 70c96b3 Raw
135 lines · plain
1; RUN: llc -O0 < %s | FileCheck %s2 3source_filename = "t.c"4target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32"5target triple = "i386-pc-windows-msvc19.0.24215"6 7@str_const = internal unnamed_addr constant [4 x i8] c"str\00", align 18 9declare i32 @puts(ptr)10declare void @use_i32(ptr)11declare void @llvm.dbg.value(metadata, metadata, metadata) nounwind readnone12 13; We had a line info quality issue where the LEA for the string constant had no14; location info, so the .cv_loc directive appeared after it. Now we have logic15; that tries to emit the first valid location to the top of each MBB.16 17define void @lea_str_loc(i1 %cond) !dbg !8 {18entry:19  br i1 %cond, label %if.then, label %if.end, !dbg !1720 21if.then:                                          ; preds = %entry22  br label %return, !dbg !1823 24if.end:                                           ; preds = %entry25  %call = call i32 @puts(ptr @str_const), !dbg !1926  br label %return, !dbg !2027 28return:                                           ; preds = %if.end, %if.then29  ret void, !dbg !2030}31 32; The t.c:5 line marker should appear immediately after the BB label.33 34; CHECK-LABEL: _lea_str_loc:35; CHECK:         .cv_loc {{.*}} # t.c:4:536; CHECK:         jmp     LBB{{.*}}37; CHECK: LBB0_{{.*}}:                                 # %if.end38; CHECK-NEXT:    .cv_loc {{.*}} # t.c:5:339; CHECK-NEXT:    leal    _str_const, %[[reg:[^ ]*]]40; CHECK-NEXT:    movl    %[[reg]], (%esp)41; CHECK-NEXT:    calll   _puts42 43define void @instr_no_loc(i1 %cond) !dbg !21 {44entry:45  br i1 %cond, label %if.then, label %if.end, !dbg !2246 47if.then:                                          ; preds = %entry48  br label %return, !dbg !2349 50if.end:                                           ; preds = %entry51  call void asm sideeffect "nop", ""()52  %call = call i32 @puts(ptr @str_const), !dbg !2453  br label %return, !dbg !2554 55return:                                           ; preds = %if.end, %if.then56  ret void, !dbg !2557}58 59; CHECK-LABEL: _instr_no_loc:60; CHECK:         .cv_loc {{.*}} # t.c:4:561; CHECK:         jmp     LBB{{.*}}62; CHECK: LBB1_{{.*}}:                                 # %if.end63; CHECK-NEXT:    .cv_loc {{.*}} # t.c:5:364; CHECK-NEXT:    #APP65; CHECK-NEXT:    nop66; CHECK-NEXT:    #NO_APP67; CHECK-NEXT:    leal    _str_const, %[[reg:[^ ]*]]68; CHECK-NEXT:    movl    %[[reg]], (%esp)69; CHECK-NEXT:    calll   _puts70 71define void @lea_dbg_value(i1 %cond) !dbg !30 {72entry:73  %value = alloca i3274  store i32 42, ptr %value75  br i1 %cond, label %if.then, label %if.end, !dbg !3176 77if.then:                                          ; preds = %entry78  br label %return, !dbg !3279 80if.end:                                           ; preds = %entry81  call void @llvm.dbg.value(metadata ptr %value, metadata !35, metadata !13), !dbg !3482  call void @use_i32(ptr %value), !dbg !3383  br label %return, !dbg !3484 85return:                                           ; preds = %if.end, %if.then86  ret void, !dbg !3487}88 89; CHECK-LABEL: _lea_dbg_value:90; CHECK:         .cv_loc {{.*}} # t.c:4:591; CHECK:         jmp     LBB{{.*}}92; CHECK: LBB2_{{.*}}:                                 # %if.end93; CHECK-NEXT: L{{.*}}:94; CHECK-NEXT: DEBUG_VALUE: lea_dbg_value:95; CHECK-NEXT:    .cv_loc {{.*}} # t.c:5:396; CHECK:         leal 4(%esp), %[[reg:[^ ]*]]97; CHECK:         movl    %[[reg]], (%esp)98; CHECK:         calll   _use_i3299 100!llvm.dbg.cu = !{!0}101!llvm.module.flags = !{!3, !4, !5, !6}102!llvm.ident = !{!7}103 104!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 5.0.0 ", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)105!1 = !DIFile(filename: "t.c", directory: "C:\5Csrc\5Cllvm-project\5Cbuild", checksumkind: CSK_MD5, checksum: "b32df088e991f1996b4e4deb3855c14b")106!2 = !{}107!3 = !{i32 1, !"NumRegisterParameters", i32 0}108!4 = !{i32 2, !"CodeView", i32 1}109!5 = !{i32 2, !"Debug Info Version", i32 3}110!6 = !{i32 1, !"wchar_size", i32 2}111!7 = !{!"clang version 5.0.0 "}112!8 = distinct !DISubprogram(name: "lea_str_loc", scope: !1, file: !1, line: 2, type: !9, isLocal: false, isDefinition: true, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)113!9 = !DISubroutineType(types: !10)114!10 = !{null, !11}115!11 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)116!13 = !DIExpression(DW_OP_deref)117!14 = !DILocation(line: 2, column: 12, scope: !8)118!15 = !DILocation(line: 3, column: 7, scope: !16)119!16 = distinct !DILexicalBlock(scope: !8, file: !1, line: 3, column: 7)120!17 = !DILocation(line: 3, column: 7, scope: !8)121!18 = !DILocation(line: 4, column: 5, scope: !16)122!19 = !DILocation(line: 5, column: 3, scope: !8)123!20 = !DILocation(line: 6, column: 1, scope: !8)124!21 = distinct !DISubprogram(name: "instr_no_loc", scope: !1, file: !1, line: 2, type: !9, isLocal: false, isDefinition: true, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)125!22 = !DILocation(line: 3, column: 7, scope: !21)126!23 = !DILocation(line: 4, column: 5, scope: !21)127!24 = !DILocation(line: 5, column: 3, scope: !21)128!25 = !DILocation(line: 6, column: 1, scope: !21)129!30 = distinct !DISubprogram(name: "lea_dbg_value", scope: !1, file: !1, line: 2, type: !9, isLocal: false, isDefinition: true, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)130!31 = !DILocation(line: 3, column: 7, scope: !30)131!32 = !DILocation(line: 4, column: 5, scope: !30)132!33 = !DILocation(line: 5, column: 3, scope: !30)133!34 = !DILocation(line: 6, column: 1, scope: !30)134!35 = !DILocalVariable(name: "v", scope: !30, file: !1, line: 3, type: !11)135