r211408 - CodeGen: typeid/dynamic_cast tests don't need asserts

David Majnemer david.majnemer at gmail.com
Fri Jun 20 14:44:39 PDT 2014


Author: majnemer
Date: Fri Jun 20 16:44:39 2014
New Revision: 211408

URL: http://llvm.org/viewvc/llvm-project?rev=211408&view=rev
Log:
CodeGen: typeid/dynamic_cast tests don't need asserts

These tests relied on information that was only available for clang
builds that included asserts.  Fix these tests to lift that restriction.

Modified:
    cfe/trunk/test/CodeGenCXX/microsoft-abi-dynamic-cast.cpp
    cfe/trunk/test/CodeGenCXX/microsoft-abi-typeid.cpp

Modified: cfe/trunk/test/CodeGenCXX/microsoft-abi-dynamic-cast.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/microsoft-abi-dynamic-cast.cpp?rev=211408&r1=211407&r2=211408&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/microsoft-abi-dynamic-cast.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/microsoft-abi-dynamic-cast.cpp Fri Jun 20 16:44:39 2014
@@ -1,5 +1,4 @@
 // 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(); };
@@ -55,11 +54,9 @@ T* test4(V* x) { return dynamic_cast<T*>
 
 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
@@ -68,20 +65,17 @@ T* test5(A* x) { return dynamic_cast<T*>
 // 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*
@@ -90,9 +84,8 @@ T* test6(B* x) { return dynamic_cast<T*>
 // 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); }
@@ -103,30 +96,25 @@ void* test7(V* x) { return dynamic_cast<
 
 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
@@ -136,8 +124,7 @@ void* test9(B* x) { return dynamic_cast<
 // 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]]
 

Modified: cfe/trunk/test/CodeGenCXX/microsoft-abi-typeid.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/microsoft-abi-typeid.cpp?rev=211408&r1=211407&r2=211408&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/microsoft-abi-typeid.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/microsoft-abi-typeid.cpp Fri Jun 20 16:44:39 2014
@@ -1,5 +1,4 @@
 // RUN: %clang_cc1 -emit-llvm -O1 -o - -triple=i386-pc-win32 %s | FileCheck %s
-// REQUIRES: asserts
 
 struct type_info;
 namespace std { using ::type_info; }
@@ -27,12 +26,10 @@ const std::type_info* test3_typeid() { r
 // CHECK-LABEL: define %struct.type_info* @"\01?test3_typeid@@YAPBUtype_info@@XZ"()
 // CHECK:        [[CALL:%.*]] = tail call %struct.A* @"\01?fn@@YAPAUA@@XZ"()
 // CHECK-NEXT:   [[CMP:%.*]] = icmp eq %struct.A* [[CALL]], null
-// CHECK-NEXT:   br i1 [[CMP]], label %typeid.bad_typeid, label %typeid.end
-// CHECK-LABEL: typeid.bad_typeid:
-// CHECK-NEXT:   tail call i8* @__RTtypeid(i8* null)
+// CHECK-NEXT:   br i1 [[CMP]]
+// CHECK:        tail call i8* @__RTtypeid(i8* null)
 // CHECK-NEXT:   unreachable
-// CHECK-LABEL: typeid.end:
-// CHECK-NEXT:   [[THIS:%.*]] = bitcast %struct.A* [[CALL]] to i8*
+// CHECK:        [[THIS:%.*]] = bitcast %struct.A* [[CALL]] to i8*
 // CHECK-NEXT:   [[VBTBLP:%.*]] = bitcast %struct.A* [[CALL]] to i8**
 // CHECK-NEXT:   [[VBTBL:%.*]] = load i8** [[VBTBLP]], align 4
 // CHECK-NEXT:   [[VBSLOT:%.*]] = getelementptr inbounds i8* [[VBTBL]], i32 4





More information about the cfe-commits mailing list