1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 2
2 ; RUN: opt -S -passes=jump-threading < %s | FileCheck %s
4 ; Make sure we don't crash while trying to calculate the object size of an
7 define void @test(i16 %arg) {
8 ; CHECK-LABEL: define void @test
9 ; CHECK-SAME: (i16 [[ARG:%.*]]) {
11 ; CHECK-NEXT: br label [[BB8THREAD_PRE_SPLIT1:%.*]]
12 ; CHECK: bb8thread-pre-split1:
13 ; CHECK-NEXT: [[LOAD_PR_PR:%.*]] = load i16, ptr null, align 2
14 ; CHECK-NEXT: br label [[BB8:%.*]]
16 ; CHECK-NEXT: [[LOAD_PR:%.*]] = phi i16 [ [[LOAD_PR_PR]], [[BB8THREAD_PRE_SPLIT1]] ], [ [[LOAD_PR]], [[BB8]] ]
17 ; CHECK-NEXT: [[I:%.*]] = icmp eq i16 [[LOAD_PR]], 0
18 ; CHECK-NEXT: br i1 [[I]], label [[BB10:%.*]], label [[BB8]]
20 ; CHECK-NEXT: [[I1:%.*]] = getelementptr { i128, i8 }, ptr null, i64 0, i32 1
21 ; CHECK-NEXT: store i8 0, ptr [[I1]], align 8
22 ; CHECK-NEXT: [[I2:%.*]] = load i128, ptr null, align 8
23 ; CHECK-NEXT: [[I3:%.*]] = icmp eq i128 [[I2]], 0
24 ; CHECK-NEXT: br i1 [[I3]], label [[BB8THREAD_PRE_SPLIT1]], label [[BB8THREAD_PRE_SPLIT1]]
29 bb20: ; preds = %bb19, %bb17, %bb17, %bb14, %bb13
32 bb5: ; preds = %bb16, %bb10, %bb10, %bb8, %start
33 %_11.0 = phi ptr [ %_11.5, %bb16 ], [ null, %bb10 ], [ null, %bb8 ], [ null, %bb10 ], [ null, %start ]
36 bb8: ; preds = %bb15, %bb9, %bb5
37 %load = load i16, ptr null, align 2
38 %i = icmp eq i16 %load, 0
39 br i1 %i, label %bb9, label %bb5
42 switch i16 %load, label %bb8 [
47 bb10: ; preds = %bb14, %bb13, %bb9
48 %_2.7 = phi ptr [ %_11.0, %bb14 ], [ %_11.0, %bb13 ], [ null, %bb9 ]
49 %i1 = getelementptr { i128, i8 }, ptr %_11.0, i64 0, i32 1
50 store i8 0, ptr %i1, align 8
51 %i2 = load i128, ptr %_2.7, align 8
52 %i3 = icmp eq i128 %i2, 0
53 br i1 %i3, label %bb5, label %bb5
55 bb13: ; preds = %bb14, %bb9
56 switch i128 0, label %bb20 [
61 bb14: ; preds = %bb19, %bb13
62 switch i16 %arg, label %bb20 [
69 switch i16 %arg, label %bb16 [
74 bb16: ; preds = %bb19, %bb15
75 %_11.5 = phi ptr [ null, %bb15 ], [ null, %bb19 ]
78 bb17: ; preds = %bb19, %bb15
79 switch i16 %arg, label %bb20 [
85 switch i16 %arg, label %bb16 [