xref: /llvm-project/llvm/test/CodeGen/Hexagon/misched-top-rptracker-sync.ll (revision 2208c97c1bec2512d4e47b6223db6d95a7037956)
1; RUN: llc -mtriple=hexagon < %s
2; REQUIRES: asserts
3
4; Check that we no longer get this error:
5; void llvm::ScheduleDAGMILive::scheduleMI(llvm::SUnit *, bool):
6; Assertion `TopRPTracker.getPos() == CurrentTop && "out of sync"' failed.
7
8target triple = "hexagon"
9
10%struct.A = type { ptr, ptr }
11%struct.B = type { ptr, ptr, ptr }
12
13@.str.4 = external hidden unnamed_addr constant [41 x i8], align 1
14@__func__.fred = external hidden unnamed_addr constant [16 x i8], align 1
15@.str.5 = external hidden unnamed_addr constant [43 x i8], align 1
16
17; Function Attrs: nounwind
18declare void @_Assert(ptr, ptr) #0
19
20; Function Attrs: nounwind
21define void @fred(ptr %pA, ptr %p) #0 !dbg !6 {
22entry:
23  tail call void @llvm.dbg.value(metadata ptr %pA, i64 0, metadata !26, metadata !28), !dbg !29
24  tail call void @llvm.dbg.value(metadata ptr %p, i64 0, metadata !27, metadata !28), !dbg !30
25  %cmp = icmp eq ptr %p, null, !dbg !31
26  br i1 %cmp, label %cond.false, label %cond.end, !dbg !31
27
28cond.false:                                       ; preds = %entry
29  tail call void @_Assert(ptr @.str.4, ptr @__func__.fred) #0, !dbg !32
30  br label %cond.end, !dbg !32
31
32cond.end:                                         ; preds = %cond.false, %entry
33  %cmp1 = icmp eq ptr %pA, null, !dbg !34
34  br i1 %cmp1, label %cond.false3, label %cond.end4, !dbg !34
35
36cond.false3:                                      ; preds = %cond.end
37  tail call void @_Assert(ptr @.str.5, ptr @__func__.fred) #0, !dbg !35
38  br label %cond.end4, !dbg !35
39
40cond.end4:                                        ; preds = %cond.false3, %cond.end
41  %0 = load ptr, ptr %pA, align 4, !dbg !38, !tbaa !39
42  %cmp5 = icmp eq ptr %0, null, !dbg !44
43  br i1 %cmp5, label %if.then, label %if.end, !dbg !45
44
45if.then:                                          ; preds = %cond.end4
46  %p1 = getelementptr inbounds %struct.A, ptr %pA, i32 0, i32 1, !dbg !46
47  store ptr %p, ptr %p1, align 4, !dbg !48, !tbaa !49
48  store ptr %p, ptr %pA, align 4, !dbg !50, !tbaa !39
49  %p4 = getelementptr inbounds %struct.B, ptr %p, i32 0, i32 1, !dbg !51
50  store ptr null, ptr %p4, align 4, !dbg !52, !tbaa !53
51  %p5 = getelementptr inbounds %struct.B, ptr %p, i32 0, i32 2, !dbg !55
52  store ptr null, ptr %p5, align 4, !dbg !56, !tbaa !57
53  br label %return, !dbg !58
54
55if.end:                                           ; preds = %cond.end4
56  %1 = ptrtoint ptr %0 to i32, !dbg !59
57  %p57 = getelementptr inbounds %struct.B, ptr %p, i32 0, i32 2, !dbg !60
58  store ptr null, ptr %p57, align 4, !dbg !61, !tbaa !57
59  %p49 = getelementptr inbounds %struct.B, ptr %p, i32 0, i32 1, !dbg !62
60  store i32 %1, ptr %p49, align 4, !dbg !63, !tbaa !53
61  %p511 = getelementptr inbounds %struct.B, ptr %0, i32 0, i32 2, !dbg !64
62  store ptr %p, ptr %p511, align 4, !dbg !65, !tbaa !57
63  store ptr %p, ptr %pA, align 4, !dbg !66, !tbaa !39
64  br label %return, !dbg !67
65
66return:                                           ; preds = %if.end, %if.then
67  ret void, !dbg !68
68}
69
70; Function Attrs: nounwind readnone
71declare void @llvm.dbg.value(metadata, i64, metadata, metadata) #1
72
73attributes #0 = { nounwind }
74attributes #1 = { nounwind readnone }
75
76!llvm.dbg.cu = !{!0}
77!llvm.module.flags = !{!3, !4}
78!llvm.ident = !{!5}
79
80!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 3.9.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
81!1 = !DIFile(filename: "bug.c", directory: "/")
82!2 = !{}
83!3 = !{i32 2, !"Dwarf Version", i32 4}
84!4 = !{i32 2, !"Debug Info Version", i32 3}
85!5 = !{!"clang version 3.9.0"}
86!6 = distinct !DISubprogram(name: "fred", scope: !1, file: !1, line: 138, type: !7, isLocal: false, isDefinition: true, scopeLine: 139, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !25)
87!7 = !DISubroutineType(types: !8)
88!8 = !{null, !9, !15}
89!9 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !10, size: 32, align: 32)
90!10 = !DIDerivedType(tag: DW_TAG_typedef, name: "A", file: !11, line: 57, baseType: !12)
91!11 = !DIFile(filename: "bug.h", directory: "/")
92!12 = distinct !DICompositeType(tag: DW_TAG_structure_type, file: !11, line: 54, size: 64, align: 32, elements: !13)
93!13 = !{!14, !24}
94!14 = !DIDerivedType(tag: DW_TAG_member, name: "p2", scope: !12, file: !11, line: 55, baseType: !15, size: 32, align: 32)
95!15 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !16, size: 32, align: 32)
96!16 = !DIDerivedType(tag: DW_TAG_typedef, name: "B", file: !11, line: 50, baseType: !17)
97!17 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "B", file: !11, line: 45, size: 96, align: 32, elements: !18)
98!18 = !{!19, !21, !23}
99!19 = !DIDerivedType(tag: DW_TAG_member, name: "p3", scope: !17, file: !11, line: 47, baseType: !20, size: 32, align: 32)
100!20 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 32, align: 32)
101!21 = !DIDerivedType(tag: DW_TAG_member, name: "p4", scope: !17, file: !11, line: 48, baseType: !22, size: 32, align: 32, offset: 32)
102!22 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !17, size: 32, align: 32)
103!23 = !DIDerivedType(tag: DW_TAG_member, name: "p5", scope: !17, file: !11, line: 49, baseType: !22, size: 32, align: 32, offset: 64)
104!24 = !DIDerivedType(tag: DW_TAG_member, name: "p1", scope: !12, file: !11, line: 56, baseType: !15, size: 32, align: 32, offset: 32)
105!25 = !{!26, !27}
106!26 = !DILocalVariable(name: "pA", arg: 1, scope: !6, file: !1, line: 138, type: !9)
107!27 = !DILocalVariable(name: "p", arg: 2, scope: !6, file: !1, line: 138, type: !15)
108!28 = !DIExpression()
109!29 = !DILocation(line: 138, column: 34, scope: !6)
110!30 = !DILocation(line: 138, column: 57, scope: !6)
111!31 = !DILocation(line: 140, column: 5, scope: !6)
112!32 = !DILocation(line: 140, column: 5, scope: !33)
113!33 = !DILexicalBlockFile(scope: !6, file: !1, discriminator: 2)
114!34 = !DILocation(line: 141, column: 5, scope: !6)
115!35 = !DILocation(line: 141, column: 5, scope: !33)
116!36 = !DILocation(line: 143, column: 30, scope: !37)
117!37 = distinct !DILexicalBlock(scope: !6, file: !1, line: 143, column: 9)
118!38 = !DILocation(line: 155, column: 18, scope: !6)
119!39 = !{!40, !41, i64 0}
120!40 = !{!"", !41, i64 0, !41, i64 4}
121!41 = !{!"any pointer", !42, i64 0}
122!42 = !{!"omnipotent char", !43, i64 0}
123!43 = !{!"Simple C/C++ TBAA"}
124!44 = !DILocation(line: 143, column: 14, scope: !37)
125!45 = !DILocation(line: 143, column: 9, scope: !6)
126!46 = !DILocation(line: 146, column: 26, scope: !47)
127!47 = distinct !DILexicalBlock(scope: !37, file: !1, line: 143, column: 41)
128!48 = !DILocation(line: 146, column: 36, scope: !47)
129!49 = !{!40, !41, i64 4}
130!50 = !DILocation(line: 145, column: 32, scope: !47)
131!51 = !DILocation(line: 147, column: 20, scope: !47)
132!52 = !DILocation(line: 147, column: 29, scope: !47)
133!53 = !{!54, !41, i64 4}
134!54 = !{!"B", !41, i64 0, !41, i64 4, !41, i64 8}
135!55 = !DILocation(line: 148, column: 20, scope: !47)
136!56 = !DILocation(line: 148, column: 29, scope: !47)
137!57 = !{!54, !41, i64 8}
138!58 = !DILocation(line: 149, column: 9, scope: !47)
139!59 = !DILocation(line: 154, column: 41, scope: !6)
140!60 = !DILocation(line: 153, column: 16, scope: !6)
141!61 = !DILocation(line: 153, column: 25, scope: !6)
142!62 = !DILocation(line: 154, column: 16, scope: !6)
143!63 = !DILocation(line: 154, column: 26, scope: !6)
144!64 = !DILocation(line: 155, column: 29, scope: !6)
145!65 = !DILocation(line: 155, column: 39, scope: !6)
146!66 = !DILocation(line: 156, column: 28, scope: !6)
147!67 = !DILocation(line: 157, column: 1, scope: !6)
148!68 = !DILocation(line: 157, column: 1, scope: !69)
149!69 = !DILexicalBlockFile(scope: !6, file: !1, discriminator: 1)
150