// RUN: %clang_cc1 -emit-llvm -O1 -o - -triple=i386-pc-win32 %s | FileCheck %s
-// REQUIRES: asserts
struct S { char a; };
struct V { virtual void f(); };
T* test5(A* x) { return dynamic_cast<T*>(x); }
// CHECK-LABEL: define %struct.T* @"\01?test5@@YAPAUT@@PAUA@@@Z"(%struct.A* %x)
-// CHECK-NEXT: [[ENTRY:.*]]:
-// CHECK-NEXT: [[CHECK:%.*]] = icmp eq %struct.A* %x, null
-// CHECK-NEXT: br i1 [[CHECK]], label %dynamic_cast.end, label %dynamic_cast.notnull
-// CHECK-LABEL: dynamic_cast.notnull:
-// CHECK-NEXT: [[VOIDP:%.*]] = bitcast %struct.A* %x to i8*
+// CHECK: [[CHECK:%.*]] = icmp eq %struct.A* %x, null
+// CHECK-NEXT: br i1 [[CHECK]]
+// CHECK: [[VOIDP:%.*]] = bitcast %struct.A* %x to i8*
// CHECK-NEXT: [[BITCAST:%.*]] = bitcast %struct.A* %x to i8**
// CHECK-NEXT: [[VBTBL:%.*]] = load i8** [[BITCAST]], align 4
// CHECK-NEXT: [[VBOFFP:%.*]] = getelementptr inbounds i8* [[VBTBL]], i32 4
// CHECK-NEXT: [[ADJ:%.*]] = getelementptr inbounds i8* [[VOIDP]], i32 [[VBOFFS]]
// CHECK-NEXT: [[CALL:%.*]] = tail call i8* @__RTDynamicCast(i8* [[ADJ]], i32 [[VBOFFS]], i8* bitcast (%"MSRTTITypeDescriptor\07"* @"\01??_R0?AUA@@@8" to i8*), i8* bitcast (%"MSRTTITypeDescriptor\07"* @"\01??_R0?AUT@@@8" to i8*), i32 0)
// CHECK-NEXT: [[RES:%.*]] = bitcast i8* [[CALL]] to %struct.T*
-// CHECK-NEXT: br label %dynamic_cast.end
-// CHECK-LABEL: dynamic_cast.end:
-// CHECK-NEXT: [[RET:%.*]] = phi %struct.T* [ [[RES]], %dynamic_cast.notnull ], [ null, %[[ENTRY]] ]
+// CHECK-NEXT: br label
+// CHECK: [[RET:%.*]] = phi %struct.T*
// CHECK-NEXT: ret %struct.T* [[RET]]
T* test6(B* x) { return dynamic_cast<T*>(x); }
// CHECK-LABEL: define %struct.T* @"\01?test6@@YAPAUT@@PAUB@@@Z"(%struct.B* %x)
-// CHECK-NEXT: [[ENTRY:.*]]:
-// CHECK-NEXT: [[CHECK:%.*]] = icmp eq %struct.B* %x, null
-// CHECK-NEXT: br i1 [[CHECK]], label %dynamic_cast.end, label %dynamic_cast.notnull
-// CHECK-LABEL: dynamic_cast.notnull:
-// CHECK-NEXT: [[CAST:%.*]] = getelementptr inbounds %struct.B* %x, i32 0, i32 0, i32 0
-// CHECK-NEXT: [[VBPTR:%.*]] = getelementptr inbounds i8* [[CAST]], i32 4
-// CHECK-NEXT: [[BITCAST]] = bitcast i8* [[VBPTR]] to i8**
+// CHECK: [[CHECK:%.*]] = icmp eq %struct.B* %x, null
+// CHECK-NEXT: br i1 [[CHECK]]
+// CHECK: [[CAST:%.*]] = getelementptr inbounds %struct.B* %x, i32 0, i32 0, i32 0
+// CHECK-NEXT: [[VBPTR:%.*]] = getelementptr inbounds i8* %3, i32 4
+// CHECK-NEXT: [[BITCAST:%.*]] = bitcast i8* [[VBPTR]] to i8**
// CHECK-NEXT: [[VBTBL:%.*]] = load i8** [[BITCAST]], align 4
// CHECK-NEXT: [[VBOFFP:%.*]] = getelementptr inbounds i8* [[VBTBL]], i32 4
// CHECK-NEXT: [[VBOFFPCAST:%.*]] = bitcast i8* [[VBOFFP]] to i32*
// CHECK-NEXT: [[ADJ:%.*]] = getelementptr inbounds i8* [[CAST]], i32 [[DELTA]]
// CHECK-NEXT: [[CALL:%.*]] = tail call i8* @__RTDynamicCast(i8* [[ADJ]], i32 [[DELTA]], i8* bitcast (%"MSRTTITypeDescriptor\07"* @"\01??_R0?AUB@@@8" to i8*), i8* bitcast (%"MSRTTITypeDescriptor\07"* @"\01??_R0?AUT@@@8" to i8*), i32 0)
// CHECK-NEXT: [[RES:%.*]] = bitcast i8* [[CALL]] to %struct.T*
-// CHECK-NEXT: br label %dynamic_cast.end
-// CHECK-LABEL: dynamic_cast.end:
-// CHECK-NEXT: [[RET:%.*]] = phi %struct.T* [ [[RES]], %dynamic_cast.notnull ], [ null, %[[ENTRY]] ]
+// CHECK-NEXT: br label
+// CHECK: [[RET:%.*]] = phi %struct.T*
// CHECK-NEXT: ret %struct.T* [[RET]]
void* test7(V* x) { return dynamic_cast<void*>(x); }
void* test8(A* x) { return dynamic_cast<void*>(x); }
// CHECK-LABEL: define i8* @"\01?test8@@YAPAXPAUA@@@Z"(%struct.A* %x)
-// CHECK-NEXT: [[ENTRY:.*]]:
-// CHECK-NEXT: [[CHECK:%.*]] = icmp eq %struct.A* %x, null
-// CHECK-NEXT: br i1 [[CHECK]], label %dynamic_cast.end, label %dynamic_cast.notnull
-// CHECK-LABEL: dynamic_cast.notnull:
-// CHECK-NEXT: [[VOIDP:%.*]] = bitcast %struct.A* %x to i8*
-// CHECK-NEXT: [[BITCAST]] = bitcast %struct.A* %x to i8**
+// CHECK: [[CHECK:%.*]] = icmp eq %struct.A* %x, null
+// CHECK-NEXT: br i1 [[CHECK]]
+// CHECK: [[VOIDP:%.*]] = bitcast %struct.A* %x to i8*
+// CHECK-NEXT: [[BITCAST:%.*]] = bitcast %struct.A* %x to i8**
// CHECK-NEXT: [[VBTBL:%.*]] = load i8** [[BITCAST]], align 4
// CHECK-NEXT: [[VBOFFP:%.*]] = getelementptr inbounds i8* [[VBTBL]], i32 4
// CHECK-NEXT: [[VBOFFPCAST:%.*]] = bitcast i8* [[VBOFFP]] to i32*
// CHECK-NEXT: [[VBOFFS:%.*]] = load i32* [[VBOFFPCAST:%.*]], align 4
// CHECK-NEXT: [[ADJ:%.*]] = getelementptr inbounds i8* [[VOIDP]], i32 [[VBOFFS]]
// CHECK-NEXT: [[RES:%.*]] = tail call i8* @__RTCastToVoid(i8* [[ADJ]])
-// CHECK-NEXT: br label %dynamic_cast.end
-// CHECK-LABEL: dynamic_cast.end:
-// CHECK-NEXT: [[RET:%.*]] = phi i8* [ [[RES]], %dynamic_cast.notnull ], [ null, %[[ENTRY]] ]
+// CHECK-NEXT: br label
+// CHECK: [[RET:%.*]] = phi i8*
// CHECK-NEXT: ret i8* [[RET]]
void* test9(B* x) { return dynamic_cast<void*>(x); }
// CHECK-LABEL: define i8* @"\01?test9@@YAPAXPAUB@@@Z"(%struct.B* %x)
-// CHECK-NEXT: [[ENTRY:.*]]:
-// CHECK-NEXT: [[CHECK:%.*]] = icmp eq %struct.B* %x, null
-// CHECK-NEXT: br i1 [[CHECK]], label %dynamic_cast.end, label %dynamic_cast.notnull
-// CHECK-LABEL: dynamic_cast.notnull:
-// CHECK-NEXT: [[CAST:%.*]] = getelementptr inbounds %struct.B* %x, i32 0, i32 0, i32 0
+// CHECK: [[CHECK:%.*]] = icmp eq %struct.B* %x, null
+// CHECK-NEXT: br i1 [[CHECK]]
+// CHECK: [[CAST:%.*]] = getelementptr inbounds %struct.B* %x, i32 0, i32 0, i32 0
// CHECK-NEXT: [[VBPTR:%.*]] = getelementptr inbounds i8* [[CAST]], i32 4
// CHECK-NEXT: [[BITCAST:%.*]] = bitcast i8* [[VBPTR]] to i8**
// CHECK-NEXT: [[VBTBL:%.*]] = load i8** [[BITCAST]], align 4
// CHECK-NEXT: [[DELTA:%.*]] = add nsw i32 [[VBOFFS]], 4
// CHECK-NEXT: [[ADJ:%.*]] = getelementptr inbounds i8* [[CAST]], i32 [[DELTA]]
// CHECK-NEXT: [[CALL:%.*]] = tail call i8* @__RTCastToVoid(i8* [[ADJ]])
-// CHECK-NEXT: br label %dynamic_cast.end
-// CHECK-LABEL: dynamic_cast.end:
-// CHECK-NEXT: [[RET:%.*]] = phi i8* [ [[CALL]], %dynamic_cast.notnull ], [ null, %[[ENTRY]] ]
+// CHECK-NEXT: br label
+// CHECK: [[RET:%.*]] = phi i8*
// CHECK-NEXT: ret i8* [[RET]]