brintos

brintos / llvm-project-archived public Read only

0
0
Text · 5.9 KiB · 1fc1c84 Raw
134 lines · plain
1; RUN: llc < %s -O0 -verify-machineinstrs | FileCheck %s2 3; Test verifies if .loc is properly set for loop and block instructions --4; the line number is not a 0 when DebugLoc is defined.5 6; Compiled from the dbg-loop-loc.c:7; int fib(int n) {8;   int i, t, a = 0, b = 1;9;   for (i = 0; i < n; i++) {10;     t = a + b; a = b; b = t;11;   }12;   return b;13; }14 15; ModuleID = 'dbg-loop-loc.bc'16source_filename = "dbg-loop-loc.c"17target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"18target triple = "wasm32-unknown-unknown"19 20; CHECK: .file 121; CHECK: .loc 1 1 022; CHECK: .loc 1 3 1523; CHECK-NEXT: block24; CHECK-NEXT: loop25; CHECK: br 026; CHECK-NOT: .loc 1 027; CHECK: end_loop28; CHECK: end_block29; CHECK-NOT: .loc 1 030; CHECK: end_function31 32; Function Attrs: noinline nounwind optnone33define hidden i32 @fib(i32 %n) #0 !dbg !7 {34entry:35  %n.addr = alloca i32, align 436  %i = alloca i32, align 437  %t = alloca i32, align 438  %a = alloca i32, align 439  %b = alloca i32, align 440  store i32 %n, ptr %n.addr, align 441  call void @llvm.dbg.declare(metadata ptr %n.addr, metadata !11, metadata !DIExpression()), !dbg !1242  call void @llvm.dbg.declare(metadata ptr %i, metadata !13, metadata !DIExpression()), !dbg !1443  call void @llvm.dbg.declare(metadata ptr %t, metadata !15, metadata !DIExpression()), !dbg !1644  call void @llvm.dbg.declare(metadata ptr %a, metadata !17, metadata !DIExpression()), !dbg !1845  store i32 0, ptr %a, align 4, !dbg !1846  call void @llvm.dbg.declare(metadata ptr %b, metadata !19, metadata !DIExpression()), !dbg !2047  store i32 1, ptr %b, align 4, !dbg !2048  store i32 0, ptr %i, align 4, !dbg !2149  br label %for.cond, !dbg !2350 51for.cond:                                         ; preds = %for.inc, %entry52  %0 = load i32, ptr %i, align 4, !dbg !2453  %1 = load i32, ptr %n.addr, align 4, !dbg !2654  %cmp = icmp slt i32 %0, %1, !dbg !2755  br i1 %cmp, label %for.body, label %for.end, !dbg !2856 57for.body:                                         ; preds = %for.cond58  %2 = load i32, ptr %a, align 4, !dbg !2959  %3 = load i32, ptr %b, align 4, !dbg !3160  %add = add nsw i32 %2, %3, !dbg !3261  store i32 %add, ptr %t, align 4, !dbg !3362  %4 = load i32, ptr %b, align 4, !dbg !3463  store i32 %4, ptr %a, align 4, !dbg !3564  %5 = load i32, ptr %t, align 4, !dbg !3665  store i32 %5, ptr %b, align 4, !dbg !3766  br label %for.inc, !dbg !3867 68for.inc:                                          ; preds = %for.body69  %6 = load i32, ptr %i, align 4, !dbg !3970  %inc = add nsw i32 %6, 1, !dbg !3971  store i32 %inc, ptr %i, align 4, !dbg !3972  br label %for.cond, !dbg !40, !llvm.loop !4173 74for.end:                                          ; preds = %for.cond75  %7 = load i32, ptr %b, align 4, !dbg !4376  ret i32 %7, !dbg !4477}78 79; Function Attrs: nounwind readnone speculatable80declare void @llvm.dbg.declare(metadata, metadata, metadata) #181 82attributes #0 = { noinline nounwind optnone "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="generic" "use-soft-float"="false" }83attributes #1 = { nounwind readnone speculatable }84 85!llvm.dbg.cu = !{!0}86!llvm.module.flags = !{!3, !4, !5}87!llvm.ident = !{!6}88 89!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 7.0.0 (trunk 326837)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)90!1 = !DIFile(filename: "dbg-loop-loc.c", directory: "/Users/yury/llvmwasm")91!2 = !{}92!3 = !{i32 2, !"Dwarf Version", i32 4}93!4 = !{i32 2, !"Debug Info Version", i32 3}94!5 = !{i32 1, !"wchar_size", i32 4}95!6 = !{!"clang version 7.0.0 (trunk 326837)"}96!7 = distinct !DISubprogram(name: "fib", scope: !1, file: !1, line: 1, type: !8, isLocal: false, isDefinition: true, scopeLine: 1, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)97!8 = !DISubroutineType(types: !9)98!9 = !{!10, !10}99!10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)100!11 = !DILocalVariable(name: "n", arg: 1, scope: !7, file: !1, line: 1, type: !10)101!12 = !DILocation(line: 1, column: 13, scope: !7)102!13 = !DILocalVariable(name: "i", scope: !7, file: !1, line: 2, type: !10)103!14 = !DILocation(line: 2, column: 7, scope: !7)104!15 = !DILocalVariable(name: "t", scope: !7, file: !1, line: 2, type: !10)105!16 = !DILocation(line: 2, column: 10, scope: !7)106!17 = !DILocalVariable(name: "a", scope: !7, file: !1, line: 2, type: !10)107!18 = !DILocation(line: 2, column: 13, scope: !7)108!19 = !DILocalVariable(name: "b", scope: !7, file: !1, line: 2, type: !10)109!20 = !DILocation(line: 2, column: 20, scope: !7)110!21 = !DILocation(line: 3, column: 10, scope: !22)111!22 = distinct !DILexicalBlock(scope: !7, file: !1, line: 3, column: 3)112!23 = !DILocation(line: 3, column: 8, scope: !22)113!24 = !DILocation(line: 3, column: 15, scope: !25)114!25 = distinct !DILexicalBlock(scope: !22, file: !1, line: 3, column: 3)115!26 = !DILocation(line: 3, column: 19, scope: !25)116!27 = !DILocation(line: 3, column: 17, scope: !25)117!28 = !DILocation(line: 3, column: 3, scope: !22)118!29 = !DILocation(line: 4, column: 9, scope: !30)119!30 = distinct !DILexicalBlock(scope: !25, file: !1, line: 3, column: 27)120!31 = !DILocation(line: 4, column: 13, scope: !30)121!32 = !DILocation(line: 4, column: 11, scope: !30)122!33 = !DILocation(line: 4, column: 7, scope: !30)123!34 = !DILocation(line: 4, column: 20, scope: !30)124!35 = !DILocation(line: 4, column: 18, scope: !30)125!36 = !DILocation(line: 4, column: 27, scope: !30)126!37 = !DILocation(line: 4, column: 25, scope: !30)127!38 = !DILocation(line: 5, column: 3, scope: !30)128!39 = !DILocation(line: 3, column: 23, scope: !25)129!40 = !DILocation(line: 3, column: 3, scope: !25)130!41 = distinct !{!41, !28, !42}131!42 = !DILocation(line: 5, column: 3, scope: !22)132!43 = !DILocation(line: 6, column: 10, scope: !7)133!44 = !DILocation(line: 6, column: 3, scope: !7)134