xref: /llvm-project/llvm/test/Transforms/JumpThreading/branch-debug-info.ll (revision d2d9dc8eb4126271ee1406c2586a4953db831d21)
1; RUN: opt -S -passes=debugify,jump-threading < %s | FileCheck %s
2; RUN: opt -S -passes=debugify,jump-threading < %s --try-experimental-debuginfo-iterators | FileCheck %s
3; Tests Bug 37966
4
5define void @test0(i32 %i) {
6; CHECK-LABEL: @test0(
7; CHECK: left:
8; CHECK: br label %left, !dbg ![[DBG0:[0-9]+]]
9 entry:
10  %c0 = icmp ult i32 %i, 5
11  br i1 %c0, label %left, label %right
12
13 left:
14  br i1 %c0, label %left, label %right ; "line 3" to -debugify
15
16 right:
17  ret void
18}
19
20define void @test1(i32 %i, i32 %len) {
21; CHECK-LABEL: @test1(
22; CHECK: left:
23; CHECK: br label %right, !dbg ![[DBG1:[0-9]+]]
24 entry:
25  %i.inc = add nuw i32 %i, 1
26  %c0 = icmp ult i32 %i.inc, %len
27  br i1 %c0, label %left, label %right
28
29 left:
30  %c1 = icmp ult i32 %i, %len
31  br i1 %c1, label %right, label %left0 ; "line 9" to -debugify
32
33 left0:
34  ret void
35
36 right:
37  ret void
38}
39
40; CHECK-DAG: ![[DBG0]] = !DILocation(line: 3,
41; CHECK-DAG: ![[DBG1]] = !DILocation(line: 9,
42
43