1; RUN: llc -march=hexagon < %s | FileCheck %s
2; Verify store/load for -g prologue
3
4; CHECK: allocframe
5; CHECK: memw([[MEM:.*]]) = r{{[0-9]+}}
6; CHECK: r{{[0-9]+}} = memw([[MEM]])
7
8; Function Attrs: nounwind
9define i32 @f0(i32 %a0) #0 !dbg !5 {
10b0:
11  %v0 = alloca i32, align 4
12  %v1 = alloca i32, align 4
13  %v2 = alloca i32, align 4
14  store i32 %a0, i32* %v1, align 4
15  call void @llvm.dbg.declare(metadata i32* %v1, metadata !9, metadata !DIExpression()), !dbg !10
16  call void @llvm.dbg.declare(metadata i32* %v2, metadata !11, metadata !DIExpression()), !dbg !12
17  %v3 = load i32, i32* %v1, align 4, !dbg !13
18  %v4 = icmp sgt i32 %v3, 1, !dbg !15
19  br i1 %v4, label %b1, label %b2, !dbg !16
20
21b1:                                               ; preds = %b0
22  %v5 = load i32, i32* %v1, align 4, !dbg !17
23  %v6 = load i32, i32* %v1, align 4, !dbg !18
24  %v7 = sub nsw i32 %v6, 1, !dbg !19
25  %v8 = call i32 @f0(i32 %v7), !dbg !20
26  %v9 = mul nsw i32 %v5, %v8, !dbg !21
27  store i32 %v9, i32* %v0, align 4, !dbg !22
28  br label %b3, !dbg !22
29
30b2:                                               ; preds = %b0
31  %v10 = load i32, i32* %v1, align 4, !dbg !23
32  store i32 %v10, i32* %v0, align 4, !dbg !24
33  br label %b3, !dbg !24
34
35b3:                                               ; preds = %b2, %b1
36  %v11 = load i32, i32* %v0, align 4, !dbg !25
37  ret i32 %v11, !dbg !25
38}
39
40; Function Attrs: nounwind readnone speculatable
41declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
42
43attributes #0 = { nounwind "target-cpu"="hexagonv55" }
44attributes #1 = { nounwind readnone speculatable }
45
46!llvm.dbg.cu = !{!0}
47!llvm.module.flags = !{!3, !4}
48
49!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "Clang", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
50!1 = !DIFile(filename: "/tmp/test.c", directory: "/tmp")
51!2 = !{}
52!3 = !{i32 2, !"Dwarf Version", i32 4}
53!4 = !{i32 2, !"Debug Info Version", i32 3}
54!5 = distinct !DISubprogram(name: "factorial", scope: !1, file: !1, line: 1, type: !6, isLocal: false, isDefinition: true, scopeLine: 1, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)
55!6 = !DISubroutineType(types: !7)
56!7 = !{!8, !8}
57!8 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
58!9 = !DILocalVariable(name: "value", arg: 1, scope: !5, file: !1, line: 1, type: !8)
59!10 = !DILocation(line: 1, column: 20, scope: !5)
60!11 = !DILocalVariable(name: "local_var", scope: !5, file: !1, line: 2, type: !8)
61!12 = !DILocation(line: 2, column: 7, scope: !5)
62!13 = !DILocation(line: 3, column: 7, scope: !14)
63!14 = distinct !DILexicalBlock(scope: !5, file: !1, line: 3, column: 7)
64!15 = !DILocation(line: 3, column: 13, scope: !14)
65!16 = !DILocation(line: 3, column: 7, scope: !5)
66!17 = !DILocation(line: 4, column: 12, scope: !14)
67!18 = !DILocation(line: 4, column: 28, scope: !14)
68!19 = !DILocation(line: 4, column: 33, scope: !14)
69!20 = !DILocation(line: 4, column: 18, scope: !14)
70!21 = !DILocation(line: 4, column: 17, scope: !14)
71!22 = !DILocation(line: 4, column: 5, scope: !14)
72!23 = !DILocation(line: 5, column: 15, scope: !14)
73!24 = !DILocation(line: 5, column: 8, scope: !14)
74!25 = !DILocation(line: 6, column: 1, scope: !5)
75