1 ; RUN: llc -march=hexagon < %s | FileCheck %s
2 ; Verify store/load for -g prologue
5 ; CHECK: memw([[MEM:.*]]) = r{{[0-9]+}}
6 ; CHECK: r{{[0-9]+}} = memw([[MEM]])
8 ; Function Attrs: nounwind
9 define i32 @f0(i32 %a0) #0 !dbg !5 {
11 %v0 = alloca i32, align 4
12 %v1 = alloca i32, align 4
13 %v2 = alloca i32, align 4
14 store i32 %a0, ptr %v1, align 4
15 call void @llvm.dbg.declare(metadata ptr %v1, metadata !9, metadata !DIExpression()), !dbg !10
16 call void @llvm.dbg.declare(metadata ptr %v2, metadata !11, metadata !DIExpression()), !dbg !12
17 %v3 = load i32, ptr %v1, align 4, !dbg !13
18 %v4 = icmp sgt i32 %v3, 1, !dbg !15
19 br i1 %v4, label %b1, label %b2, !dbg !16
22 %v5 = load i32, ptr %v1, align 4, !dbg !17
23 %v6 = load i32, ptr %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, ptr %v0, align 4, !dbg !22
28 br label %b3, !dbg !22
31 %v10 = load i32, ptr %v1, align 4, !dbg !23
32 store i32 %v10, ptr %v0, align 4, !dbg !24
33 br label %b3, !dbg !24
35 b3: ; preds = %b2, %b1
36 %v11 = load i32, ptr %v0, align 4, !dbg !25
37 ret i32 %v11, !dbg !25
40 ; Function Attrs: nounwind readnone speculatable
41 declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
43 attributes #0 = { nounwind "target-cpu"="hexagonv55" }
44 attributes #1 = { nounwind readnone speculatable }
47 !llvm.module.flags = !{!3, !4}
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")
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)
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)