1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 3
2 ; RUN: opt -S -passes=jump-threading < %s | FileCheck %s
4 declare void @set_value(ptr)
8 define void @foo(i1 %0) {
9 ; CHECK-LABEL: define void @foo(
10 ; CHECK-SAME: i1 [[TMP0:%.*]]) {
12 ; CHECK-NEXT: [[V:%.*]] = alloca i64, align 8
13 ; CHECK-NEXT: call void @set_value(ptr [[V]])
14 ; CHECK-NEXT: [[L1:%.*]] = load i64, ptr [[V]], align 8
15 ; CHECK-NEXT: br i1 [[TMP0]], label [[BB0:%.*]], label [[BB2:%.*]]
17 ; CHECK-NEXT: [[C1:%.*]] = icmp eq i64 [[L1]], 0
18 ; CHECK-NEXT: br i1 [[C1]], label [[BB2_THREAD:%.*]], label [[BB2]]
20 ; CHECK-NEXT: store i64 0, ptr [[V]], align 8
21 ; CHECK-NEXT: br label [[BB4:%.*]]
23 ; CHECK-NEXT: [[L2:%.*]] = phi i64 [ [[L1]], [[BB0]] ], [ [[L1]], [[START:%.*]] ]
24 ; CHECK-NEXT: [[TMP1:%.*]] = icmp eq i64 [[L2]], 2
25 ; CHECK-NEXT: br i1 [[TMP1]], label [[BB3:%.*]], label [[BB4]]
27 ; CHECK-NEXT: call void @bar()
28 ; CHECK-NEXT: ret void
30 ; CHECK-NEXT: ret void
33 %v = alloca i64, align 8
34 call void @set_value(ptr %v)
35 %l1 = load i64, ptr %v, align 8, !range !0
36 br i1 %0, label %bb0, label %bb2
39 %c1 = icmp eq i64 %l1, 0
40 br i1 %c1, label %bb1, label %bb2
43 store i64 0, ptr %v, align 8
46 bb2: ; preds = %bb1, %bb0, %start
47 %l2 = load i64, ptr %v, align 8
48 %1 = icmp eq i64 %l2, 2
49 br i1 %1, label %bb3, label %bb4