1 ; RUN: opt < %s -S -passes=jump-threading | FileCheck %s
3 ; Test the debug location update of the newly created PHINode
4 ; which replaces the select instruction in .exit block.
6 define i32 @unfold3(i32 %u, i32 %v, i32 %w, i32 %x, i32 %y, i32 %z, i32 %j) !dbg !5 {
7 ; CHECK: .exit.thread4:
8 ; CHECK-NEXT: [[TMP0:%.*]] = phi i32 {{.*}}, !dbg [[DBG29:![0-9]+]]
9 ; CHECK-NEXT: ret i32 [[TMP0]], !dbg [[DBG30:![0-9]+]]
11 ; CHECK: [[DBG29]] = !DILocation(line: 13,
14 %add3 = add nsw i32 %j, 2, !dbg !19
15 %cmp.i = icmp slt i32 %u, %v, !dbg !20
16 br i1 %cmp.i, label %.exit, label %cond.false.i, !dbg !21
18 cond.false.i: ; preds = %entry
19 %cmp4.i = icmp sgt i32 %u, %v, !dbg !22
20 br i1 %cmp4.i, label %.exit, label %cond.false.6.i, !dbg !23
22 cond.false.6.i: ; preds = %cond.false.i
23 %cmp8.i = icmp slt i32 %w, %x, !dbg !24
24 br i1 %cmp8.i, label %.exit, label %cond.false.10.i, !dbg !25
26 cond.false.10.i: ; preds = %cond.false.6.i
27 %cmp13.i = icmp sgt i32 %w, %x, !dbg !26
28 br i1 %cmp13.i, label %.exit, label %cond.false.15.i, !dbg !27
30 cond.false.15.i: ; preds = %cond.false.10.i
31 %phitmp = icmp sge i32 %y, %z, !dbg !28
32 br label %.exit, !dbg !29
34 .exit: ; preds = %cond.false.15.i, %cond.false.10.i, %cond.false.6.i, %cond.false.i, %entry
35 %cond23.i = phi i1 [ false, %entry ], [ true, %cond.false.i ], [ false, %cond.false.6.i ], [ %phitmp, %cond.false.15.i ], [ true, %cond.false.10.i ], !dbg !30
36 %j.add3 = select i1 %cond23.i, i32 %j, i32 %add3, !dbg !31
37 ret i32 %j.add3, !dbg !32
41 !llvm.debugify = !{!2, !3}
42 !llvm.module.flags = !{!4}
44 !0 = distinct !DICompileUnit(language: DW_LANG_C, file: !1, producer: "debugify", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug)
45 !1 = !DIFile(filename: "preserving-debugloc-trytofoldselect.ll", directory: "/")
48 !4 = !{i32 2, !"Debug Info Version", i32 3}
49 !5 = distinct !DISubprogram(name: "unfold3", linkageName: "unfold3", scope: null, file: !1, line: 1, type: !6, scopeLine: 1, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !8)
50 !6 = !DISubroutineType(types: !7)
52 !8 = !{!9, !11, !13, !14, !15, !16, !17, !18}
53 !9 = !DILocalVariable(name: "1", scope: !5, file: !1, line: 1, type: !10)
54 !10 = !DIBasicType(name: "ty32", size: 32, encoding: DW_ATE_unsigned)
55 !11 = !DILocalVariable(name: "2", scope: !5, file: !1, line: 2, type: !12)
56 !12 = !DIBasicType(name: "ty8", size: 8, encoding: DW_ATE_unsigned)
57 !13 = !DILocalVariable(name: "3", scope: !5, file: !1, line: 4, type: !12)
58 !14 = !DILocalVariable(name: "4", scope: !5, file: !1, line: 6, type: !12)
59 !15 = !DILocalVariable(name: "5", scope: !5, file: !1, line: 8, type: !12)
60 !16 = !DILocalVariable(name: "6", scope: !5, file: !1, line: 10, type: !12)
61 !17 = !DILocalVariable(name: "7", scope: !5, file: !1, line: 12, type: !12)
62 !18 = !DILocalVariable(name: "8", scope: !5, file: !1, line: 13, type: !10)
63 !19 = !DILocation(line: 1, column: 1, scope: !5)
64 !20 = !DILocation(line: 2, column: 1, scope: !5)
65 !21 = !DILocation(line: 3, column: 1, scope: !5)
66 !22 = !DILocation(line: 4, column: 1, scope: !5)
67 !23 = !DILocation(line: 5, column: 1, scope: !5)
68 !24 = !DILocation(line: 6, column: 1, scope: !5)
69 !25 = !DILocation(line: 7, column: 1, scope: !5)
70 !26 = !DILocation(line: 8, column: 1, scope: !5)
71 !27 = !DILocation(line: 9, column: 1, scope: !5)
72 !28 = !DILocation(line: 10, column: 1, scope: !5)
73 !29 = !DILocation(line: 11, column: 1, scope: !5)
74 !30 = !DILocation(line: 12, column: 1, scope: !5)
75 !31 = !DILocation(line: 13, column: 1, scope: !5)
76 !32 = !DILocation(line: 14, column: 1, scope: !5)