1; RUN: llc < %s -march=hexagon -disable-lsr | FileCheck %s
2
3; CHECK:     loop0(
4; CHECK-NOT: add({{r[0-9]*}}, #
5; CHECK:     endloop0
6
7target datalayout = "e-p:32:32:32-i64:64:64-i32:32:32-i16:16:16-i1:32:32-f64:64:64-f32:32:32-v64:64:64-v32:32:32-a0:0-n16:32"
8target triple = "hexagon"
9
10define void @f0(i32* nocapture %a0, i32* nocapture %a1) #0 !dbg !4 {
11b0:
12  call void @llvm.dbg.value(metadata i32* %a0, metadata !10, metadata !DIExpression()), !dbg !14
13  call void @llvm.dbg.value(metadata i32* %a1, metadata !11, metadata !DIExpression()), !dbg !15
14  call void @llvm.dbg.value(metadata i32 0, metadata !12, metadata !DIExpression()), !dbg !16
15  br label %b1, !dbg !16
16
17b1:                                               ; preds = %b1, %b0
18  %v0 = phi i32* [ %a0, %b0 ], [ %v7, %b1 ]
19  %v1 = phi i32 [ 0, %b0 ], [ %v5, %b1 ]
20  %v2 = phi i32* [ %a1, %b0 ], [ %v3, %b1 ]
21  %v3 = getelementptr inbounds i32, i32* %v2, i32 1, !dbg !18
22  call void @llvm.dbg.value(metadata i32* %v3, metadata !11, metadata !DIExpression()), !dbg !18
23  %v4 = load i32, i32* %v2, align 4, !dbg !18
24  store i32 %v4, i32* %v0, align 4, !dbg !18
25  %v5 = add nsw i32 %v1, 1, !dbg !20
26  call void @llvm.dbg.value(metadata i32 %v5, metadata !12, metadata !DIExpression()), !dbg !20
27  %v6 = icmp eq i32 %v5, 10, !dbg !16
28  %v7 = getelementptr i32, i32* %v0, i32 1
29  br i1 %v6, label %b2, label %b1, !dbg !16
30
31b2:                                               ; preds = %b1
32  ret void, !dbg !21
33}
34
35declare void @llvm.dbg.value(metadata, metadata, metadata) #1
36
37attributes #0 = { nounwind "target-cpu"="hexagonv5" }
38attributes #1 = { nounwind readnone speculatable }
39
40!llvm.dbg.cu = !{!0}
41!llvm.module.flags = !{!3}
42
43!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "QuIC LLVM Hexagon Clang", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !2, globals: !2)
44!1 = !DIFile(filename: "hwloop-dbg.c", directory: "/test")
45!2 = !{}
46!3 = !{i32 1, !"Debug Info Version", i32 3}
47!4 = distinct !DISubprogram(name: "foo", scope: null, file: !1, line: 1, type: !5, isLocal: false, isDefinition: true, scopeLine: 1, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !9)
48!5 = !DISubroutineType(types: !6)
49!6 = !{null, !7, !7}
50!7 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !8, size: 32, align: 32)
51!8 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
52!9 = !{!10, !11, !12}
53!10 = !DILocalVariable(name: "a", arg: 1, scope: !4, file: !1, line: 1, type: !7)
54!11 = !DILocalVariable(name: "b", arg: 2, scope: !4, file: !1, line: 1, type: !7)
55!12 = !DILocalVariable(name: "i", scope: !13, file: !1, line: 2, type: !8)
56!13 = distinct !DILexicalBlock(scope: !4, file: !1, line: 1, column: 26)
57!14 = !DILocation(line: 1, column: 15, scope: !4)
58!15 = !DILocation(line: 1, column: 23, scope: !4)
59!16 = !DILocation(line: 3, column: 8, scope: !17)
60!17 = distinct !DILexicalBlock(scope: !13, file: !1, line: 3, column: 3)
61!18 = !DILocation(line: 4, column: 5, scope: !19)
62!19 = distinct !DILexicalBlock(scope: !17, file: !1, line: 3, column: 28)
63!20 = !DILocation(line: 3, column: 23, scope: !17)
64!21 = !DILocation(line: 6, column: 1, scope: !13)
65