brintos

brintos / llvm-project-archived public Read only

0
0
Text · 5.0 KiB · 78aec4c Raw
109 lines · plain
1; FIXME: use -stop-after when MIR serialization output includes needed debug info.2; RUN: llc < %s -print-after=wasm-optimize-live-intervals 2>&1 | FileCheck %s3 4; CHECK: {{.*}}After WebAssembly Optimize Live Intervals5; CHECK: bb.3.for.body.for.body_crit_edge:6; CHECK: [[REG:%[0-9]+]]:i32 = nsw ADD_I32 {{.*}} fib.c:7:77; CHECK: DBG_VALUE [[REG]]:i32, $noreg, !"a", {{.*}} fib.c:5:138 9; ModuleID = 'fib.bc'10source_filename = "fib.c"11; void swap(int* a, int* b);12;13; __attribute__ ((visibility ("default")))14; int fib(int n) {15;   int i, t, a = 0, b = 1;16;   for (i = 0; i < n; i++) {17;     a += b;18;     swap(&a, &b);19;   }20;   return b;21; }22target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"23target triple = "wasm32-unknown-unknown-wasm"24 25; Function Attrs: nounwind26define i32 @fib(i32 %n) local_unnamed_addr #0 !dbg !7 {27entry:28  %a = alloca i32, align 429  %b = alloca i32, align 430  call void @llvm.dbg.value(metadata i32 0, metadata !15, metadata !DIExpression()), !dbg !1931  store i32 0, ptr %a, align 4, !dbg !19, !tbaa !2032  store i32 1, ptr %b, align 4, !dbg !24, !tbaa !2033  %cmp4 = icmp sgt i32 %n, 0, !dbg !2634  br i1 %cmp4, label %for.body.preheader, label %for.end, !dbg !2935 36for.body.preheader:                               ; preds = %entry37  call void @llvm.dbg.value(metadata i32 0, metadata !15, metadata !DIExpression()), !dbg !1938  store i32 1, ptr %a, align 4, !dbg !30, !tbaa !2039  call void @llvm.dbg.value(metadata ptr %a, metadata !15, metadata !DIExpression()), !dbg !1940  call void @swap(ptr nonnull %a, ptr nonnull %b) #5, !dbg !3241  %0 = load i32, ptr %b, align 4, !dbg !33, !tbaa !2042  %exitcond9 = icmp eq i32 %n, 1, !dbg !2643  br i1 %exitcond9, label %for.end, label %for.body.for.body_crit_edge, !dbg !29, !llvm.loop !3444 45for.body.for.body_crit_edge:                      ; preds = %for.body.preheader, %for.body.for.body_crit_edge46  %1 = phi i32 [ %2, %for.body.for.body_crit_edge ], [ %0, %for.body.preheader ]47  %inc10 = phi i32 [ %inc, %for.body.for.body_crit_edge ], [ 1, %for.body.preheader ]48  %.pre = load i32, ptr %a, align 4, !dbg !30, !tbaa !2049  call void @llvm.dbg.value(metadata i32 %.pre, metadata !15, metadata !DIExpression()), !dbg !1950  %add = add nsw i32 %.pre, %1, !dbg !3051  call void @llvm.dbg.value(metadata i32 %add, metadata !15, metadata !DIExpression()), !dbg !1952  store i32 %add, ptr %a, align 4, !dbg !30, !tbaa !2053  call void @llvm.dbg.value(metadata ptr %a, metadata !15, metadata !DIExpression()), !dbg !1954  call void @swap(ptr nonnull %a, ptr nonnull %b) #5, !dbg !3255  %inc = add nuw nsw i32 %inc10, 1, !dbg !3656  %2 = load i32, ptr %b, align 4, !dbg !33, !tbaa !2057  %exitcond = icmp eq i32 %inc, %n, !dbg !2658  br i1 %exitcond, label %for.end, label %for.body.for.body_crit_edge, !dbg !29, !llvm.loop !3459 60for.end:                                          ; preds = %for.body.for.body_crit_edge, %for.body.preheader, %entry61  %.lcssa = phi i32 [ 1, %entry ], [ %0, %for.body.preheader ], [ %2, %for.body.for.body_crit_edge ]62  ret i32 %.lcssa, !dbg !3863}64 65declare void @swap(ptr, ptr) local_unnamed_addr #266 67; Function Attrs: nounwind readnone speculatable68declare void @llvm.dbg.value(metadata, metadata, metadata) #469 70!llvm.dbg.cu = !{!0}71!llvm.module.flags = !{!3, !4, !5}72!llvm.ident = !{!6}73 74!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 7.0.0 (trunk 334610)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)75!1 = !DIFile(filename: "fib.c", directory: "/d/y/llvmwasm")76!2 = !{}77!3 = !{i32 2, !"Dwarf Version", i32 4}78!4 = !{i32 2, !"Debug Info Version", i32 3}79!5 = !{i32 1, !"wchar_size", i32 4}80!6 = !{!"clang version 7.0.0 (trunk 334610)"}81!7 = distinct !DISubprogram(name: "fib", scope: !1, file: !1, line: 4, type: !8, isLocal: false, isDefinition: true, scopeLine: 4, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !11)82!8 = !DISubroutineType(types: !9)83!9 = !{!10, !10}84!10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)85!11 = !{!15}86!15 = !DILocalVariable(name: "a", scope: !7, file: !1, line: 5, type: !10)87!17 = !DILocation(line: 4, column: 13, scope: !7)88!18 = !DILocation(line: 5, column: 3, scope: !7)89!19 = !DILocation(line: 5, column: 13, scope: !7)90!20 = !{!21, !21, i64 0}91!21 = !{!"int", !22, i64 0}92!22 = !{!"omnipotent char", !23, i64 0}93!23 = !{!"Simple C/C++ TBAA"}94!24 = !DILocation(line: 5, column: 20, scope: !7)95!25 = !DILocation(line: 5, column: 7, scope: !7)96!26 = !DILocation(line: 6, column: 17, scope: !27)97!27 = distinct !DILexicalBlock(scope: !28, file: !1, line: 6, column: 3)98!28 = distinct !DILexicalBlock(scope: !7, file: !1, line: 6, column: 3)99!29 = !DILocation(line: 6, column: 3, scope: !28)100!30 = !DILocation(line: 7, column: 7, scope: !31)101!31 = distinct !DILexicalBlock(scope: !27, file: !1, line: 6, column: 27)102!32 = !DILocation(line: 8, column: 5, scope: !31)103!33 = !DILocation(line: 0, scope: !7)104!34 = distinct !{!34, !29, !35}105!35 = !DILocation(line: 9, column: 3, scope: !28)106!36 = !DILocation(line: 6, column: 23, scope: !27)107!37 = !DILocation(line: 11, column: 1, scope: !7)108!38 = !DILocation(line: 10, column: 3, scope: !7)109