From: David Majnemer Date: Fri, 20 Jun 2014 21:44:39 +0000 (+0000) Subject: CodeGen: typeid/dynamic_cast tests don't need asserts X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=160000c64c6bf9e3e87626b18127cff9e4e32dde;p=platform%2Fupstream%2Fllvm.git 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. llvm-svn: 211408 --- diff --git a/clang/test/CodeGenCXX/microsoft-abi-dynamic-cast.cpp b/clang/test/CodeGenCXX/microsoft-abi-dynamic-cast.cpp index d51da7d..8e87633 100644 --- a/clang/test/CodeGenCXX/microsoft-abi-dynamic-cast.cpp +++ b/clang/test/CodeGenCXX/microsoft-abi-dynamic-cast.cpp @@ -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(x); } T* test5(A* x) { return dynamic_cast(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(x); } // 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(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(x); } // 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(x); } @@ -103,30 +96,25 @@ void* test7(V* x) { return dynamic_cast(x); } void* test8(A* x) { return dynamic_cast(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(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(x); } // 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]] diff --git a/clang/test/CodeGenCXX/microsoft-abi-typeid.cpp b/clang/test/CodeGenCXX/microsoft-abi-typeid.cpp index b8074ba..3875c56 100644 --- a/clang/test/CodeGenCXX/microsoft-abi-typeid.cpp +++ b/clang/test/CodeGenCXX/microsoft-abi-typeid.cpp @@ -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() { return &typeid(*fn()); } // 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