blob: 37f4827a81f8804f5638416c60ec45e7ea681dcf [file] [log] [blame]
Dominic Chen6ba19652016-08-11 17:52:40 +00001; RUN: llc < %s -O0 -verify-machineinstrs -mtriple=wasm32-unknown-unknown | FileCheck %s
Benjamin Kramer05e760e2016-08-12 10:13:45 +00002; REQUIRES: disabled
3
Dominic Chen6ba19652016-08-11 17:52:40 +00004; CHECK: BB#0
5; CHECK: #DEBUG_VALUE: usage:self <- %vreg4
6; CHECK: BB#1
7; CHECK: DW_TAG_variable
8target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
9target triple = "wasm32-unknown-unknown"
10
11%0 = type opaque
12
13@key = external local_unnamed_addr global [15 x i8], align 1
14@.str = external unnamed_addr constant [33 x i8], align 1
15
16; Function Attrs: nounwind
17define internal i32 @0(i8*) local_unnamed_addr !dbg !14 !type !22 {
18 tail call void @llvm.dbg.value(metadata i8* %0, i64 0, metadata !21, metadata !23), !dbg !24
19 %2 = tail call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i32 0, i32 0), i8* %0), !dbg !25
20 br i1 1, label %a, label %b
21a:
22 %3 = add i32 %2, %2
23 br label %c
24
25b:
26 %4 = sub i32 %2, %2
27 br label %c
28
29c:
30 %5 = phi i32 [ %3, %a ], [ %4, %b ]
31 %6 = add i32 ptrtoint (i32 (i8*)* @0 to i32), %5
32 ret i32 %6, !dbg !26
33}
34
35; Function Attrs: nounwind
36declare i32 @printf(i8* nocapture readonly, ...) local_unnamed_addr
37
38; Function Attrs: nounwind readnone
39declare void @llvm.dbg.value(metadata, i64, metadata, metadata)
40
41!llvm.dbg.cu = !{!0}
42!llvm.module.flags = !{!11, !12}
43!llvm.ident = !{!13}
44
45!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 3.9.0 (trunk 273884) (llvm/trunk 273897)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, globals: !3)
46!1 = !DIFile(filename: "crash.c", directory: "wasm/tests")
47!2 = !{}
48!3 = !{!4}
49!4 = distinct !DIGlobalVariable(name: "key", scope: !0, file: !1, line: 7, type: !5, isLocal: false, isDefinition: true, variable: [15 x i8]* @key)
50!5 = !DICompositeType(tag: DW_TAG_array_type, baseType: !6, size: 120, align: 8, elements: !9)
51!6 = !DIDerivedType(tag: DW_TAG_typedef, name: "uint8_t", file: !7, line: 185, baseType: !8)
52!7 = !DIFile(filename: "wasm/emscripten/system/include/libc/bits/alltypes.h", directory: "wasm/tests")
53!8 = !DIBasicType(name: "unsigned char", size: 8, align: 8, encoding: DW_ATE_unsigned_char)
54!9 = !{!10}
55!10 = !DISubrange(count: 15)
56!11 = !{i32 2, !"Dwarf Version", i32 4}
57!12 = !{i32 2, !"Debug Info Version", i32 3}
58!13 = !{!"clang version 3.9.0 (trunk 273884) (llvm/trunk 273897)"}
59!14 = distinct !DISubprogram(name: "usage", scope: !1, file: !1, line: 15, type: !15, isLocal: false, isDefinition: true, scopeLine: 15, flags: DIFlagPrototyped, isOptimized: true, unit: !0, variables: !20)
60!15 = !DISubroutineType(types: !16)
61!16 = !{!17, !18}
62!17 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
63!18 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !19, size: 32, align: 32)
64!19 = !DIBasicType(name: "char", size: 8, align: 8, encoding: DW_ATE_signed_char)
65!20 = !{!21}
66!21 = !DILocalVariable(name: "self", arg: 1, scope: !14, file: !1, line: 15, type: !18)
67!22 = !{i64 0, !"_ZTSFiPcE"}
68!23 = !DIExpression()
69!24 = !DILocation(line: 15, column: 17, scope: !14)
70!25 = !DILocation(line: 16, column: 3, scope: !14)
71!26 = !DILocation(line: 17, column: 3, scope: !14)