--- /dev/null
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 2
+; RUN: opt -S -passes=jump-threading < %s | FileCheck %s
+
+; Make sure we don't crash while trying to calculate the object size of an
+; empty phi node.
+
+define void @test(i16 %arg) {
+; CHECK-LABEL: define void @test
+; CHECK-SAME: (i16 [[ARG:%.*]]) {
+; CHECK-NEXT: start:
+; CHECK-NEXT: br label [[BB8THREAD_PRE_SPLIT1:%.*]]
+; CHECK: bb8thread-pre-split1:
+; CHECK-NEXT: [[LOAD_PR_PR:%.*]] = load i16, ptr null, align 2
+; CHECK-NEXT: br label [[BB8:%.*]]
+; CHECK: bb8:
+; CHECK-NEXT: [[LOAD_PR:%.*]] = phi i16 [ [[LOAD_PR_PR]], [[BB8THREAD_PRE_SPLIT1]] ], [ [[LOAD_PR]], [[BB8]] ]
+; CHECK-NEXT: [[I:%.*]] = icmp eq i16 [[LOAD_PR]], 0
+; CHECK-NEXT: br i1 [[I]], label [[BB10:%.*]], label [[BB8]]
+; CHECK: bb10:
+; CHECK-NEXT: [[I1:%.*]] = getelementptr { i128, i8 }, ptr null, i64 0, i32 1
+; CHECK-NEXT: store i8 0, ptr [[I1]], align 8
+; CHECK-NEXT: [[I2:%.*]] = load i128, ptr null, align 8
+; CHECK-NEXT: [[I3:%.*]] = icmp eq i128 [[I2]], 0
+; CHECK-NEXT: br i1 [[I3]], label [[BB8THREAD_PRE_SPLIT1]], label [[BB8THREAD_PRE_SPLIT1]]
+;
+start:
+ br label %bb5
+
+bb20: ; preds = %bb19, %bb17, %bb17, %bb14, %bb13
+ ret void
+
+bb5: ; preds = %bb16, %bb10, %bb10, %bb8, %start
+ %_11.0 = phi ptr [ %_11.5, %bb16 ], [ null, %bb10 ], [ null, %bb8 ], [ null, %bb10 ], [ null, %start ]
+ br label %bb8
+
+bb8: ; preds = %bb15, %bb9, %bb5
+ %load = load i16, ptr null, align 2
+ %i = icmp eq i16 %load, 0
+ br i1 %i, label %bb9, label %bb5
+
+bb9: ; preds = %bb8
+ switch i16 %load, label %bb8 [
+ i16 1, label %bb10
+ i16 0, label %bb13
+ ]
+
+bb10: ; preds = %bb14, %bb13, %bb9
+ %_2.7 = phi ptr [ %_11.0, %bb14 ], [ %_11.0, %bb13 ], [ null, %bb9 ]
+ %i1 = getelementptr { i128, i8 }, ptr %_11.0, i64 0, i32 1
+ store i8 0, ptr %i1, align 8
+ %i2 = load i128, ptr %_2.7, align 8
+ %i3 = icmp eq i128 %i2, 0
+ br i1 %i3, label %bb5, label %bb5
+
+bb13: ; preds = %bb14, %bb9
+ switch i128 0, label %bb20 [
+ i128 0, label %bb10
+ i128 1, label %bb14
+ ]
+
+bb14: ; preds = %bb19, %bb13
+ switch i16 %arg, label %bb20 [
+ i16 0, label %bb13
+ i16 2, label %bb10
+ i16 1, label %bb15
+ ]
+
+bb15: ; preds = %bb14
+ switch i16 %arg, label %bb16 [
+ i16 1, label %bb8
+ i16 0, label %bb17
+ ]
+
+bb16: ; preds = %bb19, %bb15
+ %_11.5 = phi ptr [ null, %bb15 ], [ null, %bb19 ]
+ br label %bb5
+
+bb17: ; preds = %bb19, %bb15
+ switch i16 %arg, label %bb20 [
+ i16 0, label %bb20
+ i16 1, label %bb19
+ ]
+
+bb19: ; preds = %bb17
+ switch i16 %arg, label %bb16 [
+ i16 0, label %bb14
+ i16 1, label %bb20
+ i16 6570, label %bb17
+ ]
+}