xref: /aosp_15_r20/external/llvm/test/CodeGen/ARM/coalesce-dbgvalue.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -verify-machineinstrs
2*9880d681SAndroid Build Coastguard Worker; PR16110
3*9880d681SAndroid Build Coastguard Worker;
4*9880d681SAndroid Build Coastguard Worker; This test case contains a value that is split into two connected components
5*9880d681SAndroid Build Coastguard Worker; by rematerialization during coalescing. It also contains a DBG_VALUE
6*9880d681SAndroid Build Coastguard Worker; instruction which must be updated during
7*9880d681SAndroid Build Coastguard Worker; ConnectedVNInfoEqClasses::Distribute().
8*9880d681SAndroid Build Coastguard Worker
9*9880d681SAndroid Build Coastguard Workertarget datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:32:64-v128:32:128-a0:0:32-n32-S32"
10*9880d681SAndroid Build Coastguard Workertarget triple = "thumbv7-apple-ios3.0.0"
11*9880d681SAndroid Build Coastguard Worker
12*9880d681SAndroid Build Coastguard Worker@c = common global i32 0, align 4
13*9880d681SAndroid Build Coastguard Worker@b = common global i32 0, align 4
14*9880d681SAndroid Build Coastguard Worker@a = common global i64 0, align 8
15*9880d681SAndroid Build Coastguard Worker@d = common global i32 0, align 4
16*9880d681SAndroid Build Coastguard Worker
17*9880d681SAndroid Build Coastguard Worker; Function Attrs: nounwind ssp
18*9880d681SAndroid Build Coastguard Workerdefine i32 @pr16110() #0 !dbg !4 {
19*9880d681SAndroid Build Coastguard Workerfor.cond1.preheader:
20*9880d681SAndroid Build Coastguard Worker  store i32 0, i32* @c, align 4, !dbg !21
21*9880d681SAndroid Build Coastguard Worker  br label %for.cond1.outer, !dbg !26
22*9880d681SAndroid Build Coastguard Worker
23*9880d681SAndroid Build Coastguard Workerfor.cond1:                                        ; preds = %for.end9, %for.cond1.outer
24*9880d681SAndroid Build Coastguard Worker  %storemerge11 = phi i32 [ 0, %for.end9 ], [ %storemerge11.ph, %for.cond1.outer ]
25*9880d681SAndroid Build Coastguard Worker  %cmp = icmp slt i32 %storemerge11, 1, !dbg !26
26*9880d681SAndroid Build Coastguard Worker  br i1 %cmp, label %for.body2, label %for.end9, !dbg !26
27*9880d681SAndroid Build Coastguard Worker
28*9880d681SAndroid Build Coastguard Workerfor.body2:                                        ; preds = %for.cond1
29*9880d681SAndroid Build Coastguard Worker  store i32 %storemerge11, i32* @b, align 4, !dbg !26
30*9880d681SAndroid Build Coastguard Worker  tail call void @llvm.dbg.value(metadata i32* null, i64 0, metadata !11, metadata !DIExpression()), !dbg !28
31*9880d681SAndroid Build Coastguard Worker  %0 = load i64, i64* @a, align 8, !dbg !29
32*9880d681SAndroid Build Coastguard Worker  %xor = xor i64 %0, %e.1.ph, !dbg !29
33*9880d681SAndroid Build Coastguard Worker  %conv3 = trunc i64 %xor to i32, !dbg !29
34*9880d681SAndroid Build Coastguard Worker  tail call void @llvm.dbg.value(metadata i32 %conv3, i64 0, metadata !10, metadata !DIExpression()), !dbg !29
35*9880d681SAndroid Build Coastguard Worker  %tobool4 = icmp eq i32 %conv3, 0, !dbg !29
36*9880d681SAndroid Build Coastguard Worker  br i1 %tobool4, label %land.end, label %land.rhs, !dbg !29
37*9880d681SAndroid Build Coastguard Worker
38*9880d681SAndroid Build Coastguard Workerland.rhs:                                         ; preds = %for.body2
39*9880d681SAndroid Build Coastguard Worker  %call = tail call i32 bitcast (i32 (...)* @fn3 to i32 ()*)() #3, !dbg !29
40*9880d681SAndroid Build Coastguard Worker  %tobool5 = icmp ne i32 %call, 0, !dbg !29
41*9880d681SAndroid Build Coastguard Worker  br label %land.end
42*9880d681SAndroid Build Coastguard Worker
43*9880d681SAndroid Build Coastguard Workerland.end:                                         ; preds = %land.rhs, %for.body2
44*9880d681SAndroid Build Coastguard Worker  %1 = phi i1 [ false, %for.body2 ], [ %tobool5, %land.rhs ]
45*9880d681SAndroid Build Coastguard Worker  %land.ext = zext i1 %1 to i32
46*9880d681SAndroid Build Coastguard Worker  %call6 = tail call i32 bitcast (i32 (...)* @fn2 to i32 (i32, i32*)*)(i32 %land.ext, i32* null) #3
47*9880d681SAndroid Build Coastguard Worker  %2 = load i32, i32* @b, align 4, !dbg !26
48*9880d681SAndroid Build Coastguard Worker  %inc8 = add nsw i32 %2, 1, !dbg !26
49*9880d681SAndroid Build Coastguard Worker  %phitmp = and i64 %xor, 4294967295, !dbg !26
50*9880d681SAndroid Build Coastguard Worker  br label %for.cond1.outer, !dbg !26
51*9880d681SAndroid Build Coastguard Worker
52*9880d681SAndroid Build Coastguard Workerfor.cond1.outer:                                  ; preds = %land.end, %for.cond1.preheader
53*9880d681SAndroid Build Coastguard Worker  %storemerge11.ph = phi i32 [ %inc8, %land.end ], [ 0, %for.cond1.preheader ]
54*9880d681SAndroid Build Coastguard Worker  %e.1.ph = phi i64 [ %phitmp, %land.end ], [ 0, %for.cond1.preheader ]
55*9880d681SAndroid Build Coastguard Worker  %3 = load i32, i32* @d, align 4, !dbg !31
56*9880d681SAndroid Build Coastguard Worker  %tobool10 = icmp eq i32 %3, 0, !dbg !31
57*9880d681SAndroid Build Coastguard Worker  br label %for.cond1
58*9880d681SAndroid Build Coastguard Worker
59*9880d681SAndroid Build Coastguard Workerfor.end9:                                         ; preds = %for.cond1
60*9880d681SAndroid Build Coastguard Worker  br i1 %tobool10, label %if.end, label %for.cond1, !dbg !31
61*9880d681SAndroid Build Coastguard Worker
62*9880d681SAndroid Build Coastguard Workerif.end:                                           ; preds = %for.end9
63*9880d681SAndroid Build Coastguard Worker  store i32 %storemerge11, i32* @b, align 4, !dbg !26
64*9880d681SAndroid Build Coastguard Worker  ret i32 0, !dbg !32
65*9880d681SAndroid Build Coastguard Worker}
66*9880d681SAndroid Build Coastguard Worker
67*9880d681SAndroid Build Coastguard Workerdeclare i32 @fn2(...) #1
68*9880d681SAndroid Build Coastguard Worker
69*9880d681SAndroid Build Coastguard Workerdeclare i32 @fn3(...) #1
70*9880d681SAndroid Build Coastguard Worker
71*9880d681SAndroid Build Coastguard Worker; Function Attrs: nounwind readnone
72*9880d681SAndroid Build Coastguard Workerdeclare void @llvm.dbg.value(metadata, i64, metadata, metadata) #2
73*9880d681SAndroid Build Coastguard Worker
74*9880d681SAndroid Build Coastguard Workerattributes #0 = { nounwind ssp "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" "unsafe-fp-math"="false" "use-soft-float"="false" }
75*9880d681SAndroid Build Coastguard Workerattributes #1 = { "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" "unsafe-fp-math"="false" "use-soft-float"="false" }
76*9880d681SAndroid Build Coastguard Workerattributes #2 = { nounwind readnone }
77*9880d681SAndroid Build Coastguard Workerattributes #3 = { nounwind }
78*9880d681SAndroid Build Coastguard Worker
79*9880d681SAndroid Build Coastguard Worker!llvm.dbg.cu = !{!0}
80*9880d681SAndroid Build Coastguard Worker!llvm.module.flags = !{!33}
81*9880d681SAndroid Build Coastguard Worker
82*9880d681SAndroid Build Coastguard Worker!0 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang version 3.4 (trunk 182024) (llvm/trunk 182023)", isOptimized: true, emissionKind: FullDebug, file: !1, enums: !2, retainedTypes: !2, globals: !15, imports: !2)
83*9880d681SAndroid Build Coastguard Worker!1 = !DIFile(filename: "pr16110.c", directory: "/d/b")
84*9880d681SAndroid Build Coastguard Worker!2 = !{}
85*9880d681SAndroid Build Coastguard Worker!4 = distinct !DISubprogram(name: "pr16110", line: 7, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: true, unit: !0, scopeLine: 7, file: !1, scope: !5, type: !6, variables: !9)
86*9880d681SAndroid Build Coastguard Worker!5 = !DIFile(filename: "pr16110.c", directory: "/d/b")
87*9880d681SAndroid Build Coastguard Worker!6 = !DISubroutineType(types: !7)
88*9880d681SAndroid Build Coastguard Worker!7 = !{!8}
89*9880d681SAndroid Build Coastguard Worker!8 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
90*9880d681SAndroid Build Coastguard Worker!9 = !{!10, !11}
91*9880d681SAndroid Build Coastguard Worker!10 = !DILocalVariable(name: "e", line: 8, scope: !4, file: !5, type: !8)
92*9880d681SAndroid Build Coastguard Worker!11 = !DILocalVariable(name: "f", line: 13, scope: !12, file: !5, type: !14)
93*9880d681SAndroid Build Coastguard Worker!12 = distinct !DILexicalBlock(line: 12, column: 0, file: !1, scope: !13)
94*9880d681SAndroid Build Coastguard Worker!13 = distinct !DILexicalBlock(line: 12, column: 0, file: !1, scope: !4)
95*9880d681SAndroid Build Coastguard Worker!14 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 32, align: 32, baseType: !8)
96*9880d681SAndroid Build Coastguard Worker!15 = !{!16, !18, !19, !20}
97*9880d681SAndroid Build Coastguard Worker!16 = !DIGlobalVariable(name: "a", line: 1, isLocal: false, isDefinition: true, scope: null, file: !5, type: !17, variable: i64* @a)
98*9880d681SAndroid Build Coastguard Worker!17 = !DIBasicType(tag: DW_TAG_base_type, name: "long long int", size: 64, align: 32, encoding: DW_ATE_signed)
99*9880d681SAndroid Build Coastguard Worker!18 = !DIGlobalVariable(name: "b", line: 2, isLocal: false, isDefinition: true, scope: null, file: !5, type: !8, variable: i32* @b)
100*9880d681SAndroid Build Coastguard Worker!19 = !DIGlobalVariable(name: "c", line: 3, isLocal: false, isDefinition: true, scope: null, file: !5, type: !8, variable: i32* @c)
101*9880d681SAndroid Build Coastguard Worker!20 = !DIGlobalVariable(name: "d", line: 4, isLocal: false, isDefinition: true, scope: null, file: !5, type: !8, variable: i32* @d)
102*9880d681SAndroid Build Coastguard Worker!21 = !DILocation(line: 10, scope: !22)
103*9880d681SAndroid Build Coastguard Worker!22 = distinct !DILexicalBlock(line: 10, column: 0, file: !1, scope: !4)
104*9880d681SAndroid Build Coastguard Worker!26 = !DILocation(line: 12, scope: !13)
105*9880d681SAndroid Build Coastguard Worker!27 = !{i32* null}
106*9880d681SAndroid Build Coastguard Worker!28 = !DILocation(line: 13, scope: !12)
107*9880d681SAndroid Build Coastguard Worker!29 = !DILocation(line: 14, scope: !12)
108*9880d681SAndroid Build Coastguard Worker!31 = !DILocation(line: 16, scope: !4)
109*9880d681SAndroid Build Coastguard Worker!32 = !DILocation(line: 18, scope: !4)
110*9880d681SAndroid Build Coastguard Worker!33 = !{i32 1, !"Debug Info Version", i32 3}
111