1 ; RUN: llc < %s -verify-machineinstrs
4 ; This test case contains a value that is split into two connected components
5 ; by rematerialization during coalescing. It also contains a DBG_VALUE
6 ; instruction which must be updated during
7 ; ConnectedVNInfoEqClasses::Distribute().
9 source_filename = "test/CodeGen/ARM/coalesce-dbgvalue.ll"
10 target 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"
11 target triple = "thumbv7-apple-ios3.0.0"
13 @c = common global i32 0, align 4, !dbg !0
14 @b = common global i32 0, align 4, !dbg !4
15 @a = common global i64 0, align 8, !dbg !6
16 @d = common global i32 0, align 4, !dbg !9
18 ; Function Attrs: nounwind ssp
19 define i32 @pr16110() #0 !dbg !15 {
21 store i32 0, i32* @c, align 4, !dbg !24
22 br label %for.cond1.outer, !dbg !26
24 for.cond1: ; preds = %for.end9, %for.cond1.outer
25 %storemerge11 = phi i32 [ 0, %for.end9 ], [ %storemerge11.ph, %for.cond1.outer ]
26 %cmp = icmp slt i32 %storemerge11, 1, !dbg !26
27 br i1 %cmp, label %for.body2, label %for.end9, !dbg !26
29 for.body2: ; preds = %for.cond1
30 store i32 %storemerge11, i32* @b, align 4, !dbg !26
31 tail call void @llvm.dbg.value(metadata i32* null, metadata !20, metadata !27), !dbg !28
32 %0 = load i64, i64* @a, align 8, !dbg !29
33 %xor = xor i64 %0, %e.1.ph, !dbg !29
34 %conv3 = trunc i64 %xor to i32, !dbg !29
35 tail call void @llvm.dbg.value(metadata i32 %conv3, metadata !19, metadata !27), !dbg !29
36 %tobool4 = icmp eq i32 %conv3, 0, !dbg !29
37 br i1 %tobool4, label %land.end, label %land.rhs, !dbg !29
39 land.rhs: ; preds = %for.body2
40 %call = tail call i32 bitcast (i32 (...)* @fn3 to i32 ()*)() #3, !dbg !29
41 %tobool5 = icmp ne i32 %call, 0, !dbg !29
44 land.end: ; preds = %land.rhs, %for.body2
45 %1 = phi i1 [ false, %for.body2 ], [ %tobool5, %land.rhs ]
46 %land.ext = zext i1 %1 to i32
47 %call6 = tail call i32 bitcast (i32 (...)* @fn2 to i32 (i32, i32*)*)(i32 %land.ext, i32* null) #3
48 %2 = load i32, i32* @b, align 4, !dbg !26
49 %inc8 = add nsw i32 %2, 1, !dbg !26
50 %phitmp = and i64 %xor, 4294967295, !dbg !26
51 br label %for.cond1.outer, !dbg !26
53 for.cond1.outer: ; preds = %land.end, %for.cond1.preheader
54 %storemerge11.ph = phi i32 [ %inc8, %land.end ], [ 0, %for.cond1.preheader ]
55 %e.1.ph = phi i64 [ %phitmp, %land.end ], [ 0, %for.cond1.preheader ]
56 %3 = load i32, i32* @d, align 4, !dbg !30
57 %tobool10 = icmp eq i32 %3, 0, !dbg !30
60 for.end9: ; preds = %for.cond1
61 br i1 %tobool10, label %if.end, label %for.cond1, !dbg !30
63 if.end: ; preds = %for.end9
64 store i32 %storemerge11, i32* @b, align 4, !dbg !26
68 declare i32 @fn2(...) #1
70 declare i32 @fn3(...) #1
72 ; Function Attrs: nounwind readnone
73 declare void @llvm.dbg.value(metadata, metadata, metadata) #2
75 attributes #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" }
76 attributes #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" }
77 attributes #2 = { nounwind readnone }
78 attributes #3 = { nounwind }
81 !llvm.module.flags = !{!14}
83 !0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
84 !1 = !DIGlobalVariable(name: "c", scope: null, file: !2, line: 3, type: !3, isLocal: false, isDefinition: true)
85 !2 = !DIFile(filename: "pr16110.c", directory: "/d/b")
86 !3 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
87 !4 = !DIGlobalVariableExpression(var: !5, expr: !DIExpression())
88 !5 = !DIGlobalVariable(name: "b", scope: null, file: !2, line: 2, type: !3, isLocal: false, isDefinition: true)
89 !6 = !DIGlobalVariableExpression(var: !7, expr: !DIExpression())
90 !7 = !DIGlobalVariable(name: "a", scope: null, file: !2, line: 1, type: !8, isLocal: false, isDefinition: true)
91 !8 = !DIBasicType(name: "long long int", size: 64, align: 32, encoding: DW_ATE_signed)
92 !9 = !DIGlobalVariableExpression(var: !10, expr: !DIExpression())
93 !10 = !DIGlobalVariable(name: "d", scope: null, file: !2, line: 4, type: !3, isLocal: false, isDefinition: true)
94 !11 = distinct !DICompileUnit(language: DW_LANG_C99, file: !2, producer: "clang version 3.4 (trunk 182024) (llvm/trunk 182023)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !12, retainedTypes: !12, globals: !13, imports: !12)
96 !13 = !{!6, !4, !0, !9}
97 !14 = !{i32 1, !"Debug Info Version", i32 3}
98 !15 = distinct !DISubprogram(name: "pr16110", scope: !2, file: !2, line: 7, type: !16, isLocal: false, isDefinition: true, scopeLine: 7, virtualIndex: 6, isOptimized: true, unit: !11, retainedNodes: !18)
99 !16 = !DISubroutineType(types: !17)
102 !19 = !DILocalVariable(name: "e", scope: !15, file: !2, line: 8, type: !3)
103 !20 = !DILocalVariable(name: "f", scope: !21, file: !2, line: 13, type: !23)
104 !21 = distinct !DILexicalBlock(scope: !22, file: !2, line: 12)
105 !22 = distinct !DILexicalBlock(scope: !15, file: !2, line: 12)
106 !23 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !3, size: 32, align: 32)
107 !24 = !DILocation(line: 10, scope: !25)
108 !25 = distinct !DILexicalBlock(scope: !15, file: !2, line: 10)
109 !26 = !DILocation(line: 12, scope: !22)
110 !27 = !DIExpression()
111 !28 = !DILocation(line: 13, scope: !21)
112 !29 = !DILocation(line: 14, scope: !21)
113 !30 = !DILocation(line: 16, scope: !15)
114 !31 = !DILocation(line: 18, scope: !15)