llvm.org GIT mirror llvm / bc7dc48
[SelectionDAG] getRawSubclassData should not return HasDebugValue. This change fixes a regression in r279537 and makes getRawSubclassData behave like r279536. Without this change, the fp128-g.ll test case will have an infinite loop involving SoftenFloatRes_LOAD. Differential Revision: http://reviews.llvm.org/D26942 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288420 91177308-0d34-0410-b5e6-96231b3b80d8 Chih-Hung Hsieh 3 years ago
2 changed file(s) with 187 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
414414 class SDNodeBitfields {
415415 friend class SDNode;
416416 friend class MemIntrinsicSDNode;
417 friend class MemSDNode;
417418
418419 uint16_t HasDebugValue : 1;
419420 uint16_t IsMemIntrinsic : 1;
11331134 return MMO->getAlignment();
11341135 }
11351136
1136 /// Return the SubclassData value, which contains an
1137 /// Return the SubclassData value, without HasDebugValue. This contains an
11371138 /// encoding of the volatile flag, as well as bits used by subclasses. This
11381139 /// function should only be used to compute a FoldingSetNodeID value.
1140 /// The HasDebugValue bit is masked out because CSE map needs to match
1141 /// nodes with debug info with nodes without debug info.
11391142 unsigned getRawSubclassData() const {
11401143 uint16_t Data;
1144 union {
1145 char RawSDNodeBits[sizeof(uint16_t)];
1146 SDNodeBitfields SDNodeBits;
1147 };
1148 memcpy(&RawSDNodeBits, &this->RawSDNodeBits, sizeof(this->RawSDNodeBits));
1149 SDNodeBits.HasDebugValue = 0;
11411150 memcpy(&Data, &RawSDNodeBits, sizeof(RawSDNodeBits));
11421151 return Data;
11431152 }
0 ; RUN: llc < %s -O2 -mtriple=x86_64-linux-android -mattr=+mmx | FileCheck %s --check-prefix=X64
1 ;
2 ; These cases check if x86_64-linux-android works with -O2 -g,
3 ; especially CSE matching needed by SoftenFloatRes_LOAD.
4 ; Multiple common load patterns are included to have better coverage.
5 ; When CSE matching fails, SoftenFloatResult and SoftenFloatRes_LOAD
6 ; can be called in an infinite loop.
7
8 ; ModuleID = 'fp128-g.c'
9 source_filename = "fp128-g.c"
10 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
11 target triple = "x86_64--linux-android"
12
13 @ld_ptr = common local_unnamed_addr global fp128* null, align 8, !dbg !0
14
15 ; Function Attrs: nounwind readonly uwtable
16 define fp128 @test_return1(fp128* nocapture readonly %ptr) local_unnamed_addr #0 !dbg !11 {
17 entry:
18 tail call void @llvm.dbg.value(metadata fp128* %ptr, i64 0, metadata !15, metadata !16), !dbg !17
19 %0 = load fp128, fp128* %ptr, align 16, !dbg !18, !tbaa !19
20 ret fp128 %0, !dbg !23
21 ; X64-LABEL: test_return1:
22 ; X64: .loc
23 ; X64: movaps (%rdi), %xmm0
24 ; X64: .loc
25 ; X64: retq
26 }
27
28 ; Function Attrs: nounwind readonly uwtable
29 define fp128 @test_return2(fp128* nocapture readonly %ptr) local_unnamed_addr #0 !dbg !24 {
30 entry:
31 tail call void @llvm.dbg.value(metadata fp128* %ptr, i64 0, metadata !26, metadata !16), !dbg !28
32 %0 = load fp128, fp128* %ptr, align 16, !dbg !29, !tbaa !19
33 tail call void @llvm.dbg.value(metadata fp128 %0, i64 0, metadata !27, metadata !16), !dbg !30
34 ret fp128 %0, !dbg !31
35 ; X64-LABEL: test_return2:
36 ; X64: .loc
37 ; X64: movaps (%rdi), %xmm0
38 ; X64: .loc
39 ; X64: retq
40 }
41
42 ; Function Attrs: nounwind readonly uwtable
43 define fp128 @test_return3(fp128* nocapture readonly %ptr) local_unnamed_addr #0 !dbg !32 {
44 entry:
45 tail call void @llvm.dbg.value(metadata fp128* %ptr, i64 0, metadata !34, metadata !16), !dbg !35
46 %0 = load fp128, fp128* %ptr, align 16, !dbg !36, !tbaa !19
47 %add = fadd fp128 %0, %0, !dbg !37
48 ret fp128 %add, !dbg !38
49 ; X64-LABEL: test_return3:
50 ; X64: .loc
51 ; X64: movaps (%rdi), %xmm0
52 ; X64: .loc
53 ; X64: movaps %xmm0, %xmm1
54 ; X64: callq __addtf3
55 ; X64: .loc
56 ; X64: retq
57 }
58
59 ; Function Attrs: norecurse nounwind readonly uwtable
60 define fp128 @test_return4() local_unnamed_addr #1 !dbg !39 {
61 entry:
62 %0 = load fp128*, fp128** @ld_ptr, align 8, !dbg !42, !tbaa !43
63 %1 = load fp128, fp128* %0, align 16, !dbg !45, !tbaa !19
64 ret fp128 %1, !dbg !46
65 ; X64-LABEL: test_return4:
66 ; X64: .loc
67 ; X64: movq ld_ptr(%rip), %rax
68 ; X64: .loc
69 ; X64: movaps (%rax), %xmm0
70 ; X64: .loc
71 ; X64: retq
72 }
73
74 ; Function Attrs: nounwind readonly uwtable
75 define fp128 @test_return5() local_unnamed_addr #0 !dbg !47 {
76 entry:
77 %0 = load fp128*, fp128** @ld_ptr, align 8, !dbg !50, !tbaa !43
78 %1 = load fp128, fp128* %0, align 16, !dbg !51, !tbaa !19
79 tail call void @llvm.dbg.value(metadata fp128 %1, i64 0, metadata !49, metadata !16), !dbg !52
80 ret fp128 %1, !dbg !53
81 ; X64-LABEL: test_return5:
82 ; X64: .loc
83 ; X64: movq ld_ptr(%rip), %rax
84 ; X64: .loc
85 ; X64: movaps (%rax), %xmm0
86 ; X64: .loc
87 ; X64: retq
88 }
89
90 ; Function Attrs: norecurse nounwind readonly uwtable
91 define fp128 @test_return6() local_unnamed_addr #1 !dbg !54 {
92 entry:
93 %0 = load fp128*, fp128** @ld_ptr, align 8, !dbg !55, !tbaa !43
94 %1 = load fp128, fp128* %0, align 16, !dbg !56, !tbaa !19
95 %add = fadd fp128 %1, %1, !dbg !57
96 ret fp128 %add, !dbg !58
97 ; X64-LABEL: test_return6:
98 ; X64: .loc
99 ; X64: movaps (%rax), %xmm0
100 ; X64: .loc
101 ; X64: movaps %xmm0, %xmm1
102 ; X64: callq __addtf3
103 ; X64: .loc
104 ; X64: retq
105 }
106
107 ; Function Attrs: nounwind readnone
108 declare void @llvm.dbg.value(metadata, i64, metadata, metadata) #2
109
110 attributes #0 = { nounwind readonly uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+popcnt,+sse,+sse2,+sse3,+sse4.1,+sse4.2,+ssse3,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
111 attributes #1 = { norecurse nounwind readonly uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+popcnt,+sse,+sse2,+sse3,+sse4.1,+sse4.2,+ssse3,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
112 attributes #2 = { nounwind readnone }
113
114 !llvm.dbg.cu = !{!1}
115 !llvm.module.flags = !{!7, !8, !9}
116 !llvm.ident = !{!10}
117
118 !0 = distinct !DIGlobalVariable(name: "ld_ptr", scope: !1, file: !2, line: 17, type: !5, isLocal: false, isDefinition: true)
119 !1 = distinct !DICompileUnit(language: DW_LANG_C99, file: !2, producer: "clang version 4.0.0 (trunk 281495)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !3, globals: !4)
120 !2 = !DIFile(filename: "fp128-g.c", directory: "/disk5/chh/Debug/ld.loop")
121 !3 = !{}
122 !4 = !{!0}
123 !5 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !6, size: 64, align: 64)
124 !6 = !DIBasicType(name: "long double", size: 128, align: 128, encoding: DW_ATE_float)
125 !7 = !{i32 2, !"Dwarf Version", i32 4}
126 !8 = !{i32 2, !"Debug Info Version", i32 3}
127 !9 = !{i32 1, !"PIC Level", i32 2}
128 !10 = !{!"clang version 4.0.0 (trunk 281495)"}
129 !11 = distinct !DISubprogram(name: "test_return1", scope: !2, file: !2, line: 3, type: !12, isLocal: false, isDefinition: true, scopeLine: 3, flags: DIFlagPrototyped, isOptimized: true, unit: !1, variables: !14)
130 !12 = !DISubroutineType(types: !13)
131 !13 = !{!6, !5}
132 !14 = !{!15}
133 !15 = !DILocalVariable(name: "ptr", arg: 1, scope: !11, file: !2, line: 3, type: !5)
134 !16 = !DIExpression()
135 !17 = !DILocation(line: 3, column: 39, scope: !11)
136 !18 = !DILocation(line: 4, column: 12, scope: !11)
137 !19 = !{!20, !20, i64 0}
138 !20 = !{!"long double", !21, i64 0}
139 !21 = !{!"omnipotent char", !22, i64 0}
140 !22 = !{!"Simple C/C++ TBAA"}
141 !23 = !DILocation(line: 4, column: 5, scope: !11)
142 !24 = distinct !DISubprogram(name: "test_return2", scope: !2, file: !2, line: 7, type: !12, isLocal: false, isDefinition: true, scopeLine: 7, flags: DIFlagPrototyped, isOptimized: true, unit: !1, variables: !25)
143 !25 = !{!26, !27}
144 !26 = !DILocalVariable(name: "ptr", arg: 1, scope: !24, file: !2, line: 7, type: !5)
145 !27 = !DILocalVariable(name: "value", scope: !24, file: !2, line: 8, type: !6)
146 !28 = !DILocation(line: 7, column: 39, scope: !24)
147 !29 = !DILocation(line: 9, column: 14, scope: !24)
148 !30 = !DILocation(line: 8, column: 17, scope: !24)
149 !31 = !DILocation(line: 10, column: 5, scope: !24)
150 !32 = distinct !DISubprogram(name: "test_return3", scope: !2, file: !2, line: 13, type: !12, isLocal: false, isDefinition: true, scopeLine: 13, flags: DIFlagPrototyped, isOptimized: true, unit: !1, variables: !33)
151 !33 = !{!34}
152 !34 = !DILocalVariable(name: "ptr", arg: 1, scope: !32, file: !2, line: 13, type: !5)
153 !35 = !DILocation(line: 13, column: 39, scope: !32)
154 !36 = !DILocation(line: 14, column: 12, scope: !32)
155 !37 = !DILocation(line: 14, column: 17, scope: !32)
156 !38 = !DILocation(line: 14, column: 5, scope: !32)
157 !39 = distinct !DISubprogram(name: "test_return4", scope: !2, file: !2, line: 18, type: !40, isLocal: false, isDefinition: true, scopeLine: 18, isOptimized: true, unit: !1, variables: !3)
158 !40 = !DISubroutineType(types: !41)
159 !41 = !{!6}
160 !42 = !DILocation(line: 19, column: 13, scope: !39)
161 !43 = !{!44, !44, i64 0}
162 !44 = !{!"any pointer", !21, i64 0}
163 !45 = !DILocation(line: 19, column: 12, scope: !39)
164 !46 = !DILocation(line: 19, column: 5, scope: !39)
165 !47 = distinct !DISubprogram(name: "test_return5", scope: !2, file: !2, line: 22, type: !40, isLocal: false, isDefinition: true, scopeLine: 22, isOptimized: true, unit: !1, variables: !48)
166 !48 = !{!49}
167 !49 = !DILocalVariable(name: "value", scope: !47, file: !2, line: 23, type: !6)
168 !50 = !DILocation(line: 23, column: 26, scope: !47)
169 !51 = !DILocation(line: 23, column: 25, scope: !47)
170 !52 = !DILocation(line: 23, column: 17, scope: !47)
171 !53 = !DILocation(line: 24, column: 5, scope: !47)
172 !54 = distinct !DISubprogram(name: "test_return6", scope: !2, file: !2, line: 27, type: !40, isLocal: false, isDefinition: true, scopeLine: 27, isOptimized: true, unit: !1, variables: !3)
173 !55 = !DILocation(line: 28, column: 13, scope: !54)
174 !56 = !DILocation(line: 28, column: 12, scope: !54)
175 !57 = !DILocation(line: 28, column: 20, scope: !54)
176 !58 = !DILocation(line: 28, column: 5, scope: !54)