1; RUN: llc < %s -O2 -mtriple=aarch64-none-linux-gnu
2
3; Bug 20598
4
5
6define void @test() #0 {
7entry:
8  br label %for.body, !dbg !39
9
10for.body:                                         ; preds = %for.body, %entry
11  %arrayidx5 = getelementptr inbounds i32, i32* null, i64 1, !dbg !43
12  %0 = load i32, i32* null, align 4, !dbg !45, !tbaa !46
13  %s1 = sub nsw i32 0, %0, !dbg !50
14  %n1 = sext i32 %s1 to i64, !dbg !50
15  %arrayidx21 = getelementptr inbounds i32, i32* null, i64 3, !dbg !51
16  %add53 = add nsw i64 %n1, 0, !dbg !52
17  %add55 = add nsw i64 %n1, 0, !dbg !53
18  %mul63 = mul nsw i64 %add53, -20995, !dbg !54
19  tail call void @llvm.dbg.value(metadata i64 %mul63, i64 0, metadata !30, metadata !MDExpression()), !dbg !55
20  %mul65 = mul nsw i64 %add55, -3196, !dbg !56
21  %add67 = add nsw i64 0, %mul65, !dbg !57
22  %add80 = add i64 0, 1024, !dbg !58
23  %add81 = add i64 %add80, %mul63, !dbg !58
24  %add82 = add i64 %add81, 0, !dbg !58
25  %shr83351 = lshr i64 %add82, 11, !dbg !58
26  %conv84 = trunc i64 %shr83351 to i32, !dbg !58
27  store i32 %conv84, i32* %arrayidx21, align 4, !dbg !58, !tbaa !46
28  %add86 = add i64 0, 1024, !dbg !59
29  %add87 = add i64 %add86, 0, !dbg !59
30  %add88 = add i64 %add87, %add67, !dbg !59
31  %shr89352 = lshr i64 %add88, 11, !dbg !59
32  %n2 = trunc i64 %shr89352 to i32, !dbg !59
33  store i32 %n2, i32* %arrayidx5, align 4, !dbg !59, !tbaa !46
34  br label %for.body, !dbg !39
35}
36
37; Function Attrs: nounwind readnone
38declare void @llvm.dbg.value(metadata, i64, metadata, metadata) #1
39
40attributes #0 = { nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
41attributes #1 = { nounwind readnone }
42
43!llvm.dbg.cu = !{!0}
44!llvm.module.flags = !{!36, !37}
45!llvm.ident = !{!38}
46
47!0 = !MDCompileUnit(language: DW_LANG_C99, producer: "clang version 3.6.0 ", isOptimized: true, emissionKind: 1, file: !1, enums: !2, retainedTypes: !2, subprograms: !3, globals: !2, imports: !2)
48!1 = !MDFile(filename: "test.c", directory: "")
49!2 = !{}
50!3 = !{!4}
51!4 = !MDSubprogram(name: "", line: 140, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, scopeLine: 141, file: !1, scope: !1, type: !6, function: void ()* @test, variables: !12)
52!6 = !MDSubroutineType(types: !7)
53!7 = !{null, !8}
54!8 = !MDDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !9)
55!9 = !MDDerivedType(tag: DW_TAG_typedef, line: 30, file: !1, baseType: !11)
56!11 = !MDBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
57!12 = !{!13, !14, !18, !19, !20, !21, !22, !23, !24, !25, !26, !27, !28, !29, !30, !31, !32, !33, !34, !35}
58!13 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "", line: 140, arg: 1, scope: !4, file: !1, type: !8)
59!14 = !MDLocalVariable(tag: DW_TAG_auto_variable, name: "", line: 142, scope: !4, file: !1, type: !15)
60!15 = !MDDerivedType(tag: DW_TAG_typedef, line: 183, file: !1, baseType: !17)
61!17 = !MDBasicType(tag: DW_TAG_base_type, size: 64, align: 64, encoding: DW_ATE_signed)
62!18 = !MDLocalVariable(tag: DW_TAG_auto_variable, name: "", line: 142, scope: !4, file: !1, type: !15)
63!19 = !MDLocalVariable(tag: DW_TAG_auto_variable, name: "", line: 142, scope: !4, file: !1, type: !15)
64!20 = !MDLocalVariable(tag: DW_TAG_auto_variable, name: "", line: 142, scope: !4, file: !1, type: !15)
65!21 = !MDLocalVariable(tag: DW_TAG_auto_variable, name: "", line: 142, scope: !4, file: !1, type: !15)
66!22 = !MDLocalVariable(tag: DW_TAG_auto_variable, name: "", line: 142, scope: !4, file: !1, type: !15)
67!23 = !MDLocalVariable(tag: DW_TAG_auto_variable, name: "", line: 142, scope: !4, file: !1, type: !15)
68!24 = !MDLocalVariable(tag: DW_TAG_auto_variable, name: "", line: 142, scope: !4, file: !1, type: !15)
69!25 = !MDLocalVariable(tag: DW_TAG_auto_variable, name: "", line: 143, scope: !4, file: !1, type: !15)
70!26 = !MDLocalVariable(tag: DW_TAG_auto_variable, name: "", line: 143, scope: !4, file: !1, type: !15)
71!27 = !MDLocalVariable(tag: DW_TAG_auto_variable, name: "", line: 143, scope: !4, file: !1, type: !15)
72!28 = !MDLocalVariable(tag: DW_TAG_auto_variable, name: "", line: 143, scope: !4, file: !1, type: !15)
73!29 = !MDLocalVariable(tag: DW_TAG_auto_variable, name: "", line: 144, scope: !4, file: !1, type: !15)
74!30 = !MDLocalVariable(tag: DW_TAG_auto_variable, name: "", line: 144, scope: !4, file: !1, type: !15)
75!31 = !MDLocalVariable(tag: DW_TAG_auto_variable, name: "", line: 144, scope: !4, file: !1, type: !15)
76!32 = !MDLocalVariable(tag: DW_TAG_auto_variable, name: "", line: 144, scope: !4, file: !1, type: !15)
77!33 = !MDLocalVariable(tag: DW_TAG_auto_variable, name: "", line: 144, scope: !4, file: !1, type: !15)
78!34 = !MDLocalVariable(tag: DW_TAG_auto_variable, name: "", line: 145, scope: !4, file: !1, type: !8)
79!35 = !MDLocalVariable(tag: DW_TAG_auto_variable, name: "", line: 146, scope: !4, file: !1, type: !11)
80!36 = !{i32 2, !"Dwarf Version", i32 4}
81!37 = !{i32 2, !"Debug Info Version", i32 3}
82!38 = !{!"clang version 3.6.0 "}
83!39 = !MDLocation(line: 154, column: 8, scope: !40)
84!40 = distinct !MDLexicalBlock(line: 154, column: 8, file: !1, scope: !41)
85!41 = distinct !MDLexicalBlock(line: 154, column: 8, file: !1, scope: !42)
86!42 = distinct !MDLexicalBlock(line: 154, column: 3, file: !1, scope: !4)
87!43 = !MDLocation(line: 157, column: 5, scope: !44)
88!44 = distinct !MDLexicalBlock(line: 154, column: 42, file: !1, scope: !42)
89!45 = !MDLocation(line: 159, column: 5, scope: !44)
90!46 = !{!47, !47, i64 0}
91!47 = !{!"int", !48, i64 0}
92!48 = !{!"omnipotent char", !49, i64 0}
93!49 = !{!"Simple C/C++ TBAA"}
94!50 = !MDLocation(line: 160, column: 5, scope: !44)
95!51 = !MDLocation(line: 161, column: 5, scope: !44)
96!52 = !MDLocation(line: 188, column: 5, scope: !44)
97!53 = !MDLocation(line: 190, column: 5, scope: !44)
98!54 = !MDLocation(line: 198, column: 5, scope: !44)
99!55 = !MDLocation(line: 144, column: 13, scope: !4)
100!56 = !MDLocation(line: 200, column: 5, scope: !44)
101!57 = !MDLocation(line: 203, column: 5, scope: !44)
102!58 = !MDLocation(line: 207, column: 5, scope: !44)
103!59 = !MDLocation(line: 208, column: 5, scope: !44)
104