75 lines · plain
1; RUN: llc < %s -stop-after=wasm-explicit-locals | FileCheck %s2 3; Checks if DBG_VALUEs that correspond to new `local.{tee,set}` are4; using `target-index(wasm-local)` operands.5 6target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"7target triple = "wasm32-unknown-unknown-wasm"8 9define hidden i32 @fib(i32 %n) local_unnamed_addr #0 !dbg !7 {10; CHECK: body:11entry:12 13; CHECK: %[[REG1:.*]]:i32 = CONST_I32 1,14; CHECK: LOCAL_SET_I32 [[LOOP_LOCAL:.*]], %[[REG1]],15; CHECK: DBG_VALUE 1, $noreg,16 call void @llvm.dbg.value(metadata i32 1, metadata !16, metadata !DIExpression()), !dbg !1917 %cmp8 = icmp sgt i32 %n, 0, !dbg !2118 br i1 %cmp8, label %for.body, label %for.end, !dbg !2419 20for.body: ; preds = %entry, %for.body21 %b.011 = phi i32 [ %add, %for.body ], [ 1, %entry ]22 %a.010 = phi i32 [ %b.011, %for.body ], [ 0, %entry ]23 %i.09 = phi i32 [ %inc, %for.body ], [ 0, %entry ]24 25; CHECK: %[[REG2:.*]]:i32 = LOCAL_GET_I32 [[LOOP_LOCAL]],26; CHECK: %[[REG3:.*]]:i32 = LOCAL_TEE_I32 [[TMP_LOCAL:.*]], %[[REG2]],27; CHECK: DBG_VALUE target-index(wasm-local) + [[TMP_LOCAL]], $noreg,28 call void @llvm.dbg.value(metadata i32 %b.011, metadata !16, metadata !DIExpression()), !dbg !1929 30; CHECK: %[[REG4:.*]]:i32 = nsw ADD_I3231; CHECK: LOCAL_SET_I32 [[LOOP_LOCAL]], %[[REG4]],32; CHECK: DBG_VALUE target-index(wasm-local) + [[LOOP_LOCAL]], $noreg,33 %add = add nsw i32 %b.011, %a.010, !dbg !2634 %inc = add nuw nsw i32 %i.09, 1, !dbg !2835 call void @llvm.dbg.value(metadata i32 %add, metadata !16, metadata !DIExpression()), !dbg !1936 %exitcond = icmp eq i32 %inc, %n, !dbg !2137 br i1 %exitcond, label %for.end, label %for.body, !dbg !24, !llvm.loop !2938 39for.end: ; preds = %for.body, %entry40 %b.0.lcssa = phi i32 [ 1, %entry ], [ %add, %for.body ], !dbg !3141 call void @llvm.dbg.value(metadata i32 %b.0.lcssa, metadata !16, metadata !DIExpression()), !dbg !1942 ret i32 %b.0.lcssa, !dbg !3243}44 45declare void @llvm.dbg.value(metadata, metadata, metadata) #146 47!llvm.dbg.cu = !{!0}48!llvm.module.flags = !{!4}49!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 8.0.0 ", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, nameTableKind: None)50!1 = !DIFile(filename: "<unknown>", directory: "")51!2 = !{}52!4 = !{i32 2, !"Debug Info Version", i32 3}53!7 = distinct !DISubprogram(name: "fib", scope: !1, file: !1, line: 1, type: !8, scopeLine: 1, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !11)54!8 = !DISubroutineType(types: !9)55!9 = !{!10, !10}56!10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)57!11 = !{!16}58!16 = !DILocalVariable(name: "b", scope: !7, file: !1, line: 2, type: !10)59!17 = !DILocation(line: 1, column: 13, scope: !7)60!18 = !DILocation(line: 2, column: 13, scope: !7)61!19 = !DILocation(line: 2, column: 20, scope: !7)62!20 = !DILocation(line: 2, column: 7, scope: !7)63!21 = !DILocation(line: 3, column: 17, scope: !22)64!22 = distinct !DILexicalBlock(scope: !23, file: !1, line: 3, column: 3)65!23 = distinct !DILexicalBlock(scope: !7, file: !1, line: 3, column: 3)66!24 = !DILocation(line: 3, column: 3, scope: !23)67!25 = !DILocation(line: 2, column: 10, scope: !7)68!26 = !DILocation(line: 6, column: 7, scope: !27)69!27 = distinct !DILexicalBlock(scope: !22, file: !1, line: 3, column: 27)70!28 = !DILocation(line: 3, column: 23, scope: !22)71!29 = distinct !{!29, !24, !30}72!30 = !DILocation(line: 7, column: 3, scope: !23)73!31 = !DILocation(line: 0, scope: !7)74!32 = !DILocation(line: 8, column: 3, scope: !7)75