1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -passes=jump-threading -S < %s | FileCheck %s
4 ; The indirectbr needs a block address. The add can't produce that.
5 ; This shouldn't crash.
6 define void @cast_with_binop() {
7 ; CHECK-LABEL: @cast_with_binop(
9 ; CHECK-NEXT: [[OP:%.*]] = add i64 ptrtoint (ptr inttoptr (i32 1 to ptr) to i64), undef
10 ; CHECK-NEXT: [[CAST:%.*]] = inttoptr i64 [[OP]] to ptr
11 ; CHECK-NEXT: indirectbr ptr [[CAST]], [label [[BB3:%.*]], label %bb2]
13 ; CHECK-NEXT: unreachable
15 ; CHECK-NEXT: ret void
18 %op = add i64 ptrtoint (ptr inttoptr (i32 1 to ptr) to i64), undef
19 %cast = inttoptr i64 %op to ptr
20 indirectbr ptr %cast, [label %bb3, label %bb2]
27 ; The indirectbr needs a block address. The add can't produce that.
28 ; This shouldn't crash.
29 define void @cast_with_i1(i1 %x, i1 %y) {
30 ; CHECK-LABEL: @cast_with_i1(
32 ; CHECK-NEXT: [[OP:%.*]] = add i1 [[X:%.*]], [[Y:%.*]]
33 ; CHECK-NEXT: [[CAST:%.*]] = inttoptr i1 [[OP]] to ptr
34 ; CHECK-NEXT: indirectbr ptr [[CAST]], [label [[BB3:%.*]], label %bb2]
36 ; CHECK-NEXT: unreachable
38 ; CHECK-NEXT: ret void
42 %cast = inttoptr i1 %op to ptr
43 indirectbr ptr %cast, [label %bb3, label %bb2]
50 ; The indirectbr needs a block address. The cmp can't produce that.
51 ; This shouldn't crash.
52 define void @cast_with_cmp(i1 %x, i1 %y) {
53 ; CHECK-LABEL: @cast_with_cmp(
55 ; CHECK-NEXT: [[OP:%.*]] = icmp slt i1 [[X:%.*]], [[Y:%.*]]
56 ; CHECK-NEXT: [[CAST:%.*]] = inttoptr i1 [[OP]] to ptr
57 ; CHECK-NEXT: indirectbr ptr [[CAST]], [label [[BB3:%.*]], label %bb2]
59 ; CHECK-NEXT: unreachable
61 ; CHECK-NEXT: ret void
64 %op = icmp slt i1 %x, %y
65 %cast = inttoptr i1 %op to ptr
66 indirectbr ptr %cast, [label %bb3, label %bb2]