brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.4 KiB · 63a4d55 Raw
77 lines · cpp
1// RUN: %clang_cc1 -mconstructor-aliases -std=c++11 -fexceptions -emit-llvm %s -o - -triple=i386-pc-win32 | FileCheck %s -check-prefix=X862// RUN: %clang_cc1 -mconstructor-aliases -std=c++11 -fexceptions -emit-llvm %s -o - -triple=x86_64-pc-win32 | FileCheck %s -check-prefix=X643 4struct A {5  A(int a);6  A(const A &o);7  ~A();8  int a;9};10 11void foo(A a, A b, A c) {12}13 14// Order of destruction should be left to right.15//16// X86-LABEL: define dso_local void @"?foo@@YAXUA@@00@Z"17// X86:          (ptr inalloca([[argmem_ty:<{ %struct.A, %struct.A, %struct.A }>]]) %0)18// X86: %[[a:[^ ]*]] = getelementptr inbounds nuw [[argmem_ty]], ptr %0, i32 0, i32 019// X86: %[[b:[^ ]*]] = getelementptr inbounds nuw [[argmem_ty]], ptr %0, i32 0, i32 120// X86: %[[c:[^ ]*]] = getelementptr inbounds nuw [[argmem_ty]], ptr %0, i32 0, i32 221// X86: call x86_thiscallcc void @"??1A@@QAE@XZ"(ptr {{[^,]*}} %[[a]])22// X86: call x86_thiscallcc void @"??1A@@QAE@XZ"(ptr {{[^,]*}} %[[b]])23// X86: call x86_thiscallcc void @"??1A@@QAE@XZ"(ptr {{[^,]*}} %[[c]])24// X86: ret void25 26// X64-LABEL: define dso_local void @"?foo@@YAXUA@@00@Z"27// X64:         (ptr dead_on_return noundef %[[a:[^,]*]], ptr dead_on_return noundef %[[b:[^,]*]], ptr dead_on_return noundef %[[c:[^)]*]])28// X64: call void @"??1A@@QEAA@XZ"(ptr {{[^,]*}} %[[a]])29// X64: call void @"??1A@@QEAA@XZ"(ptr {{[^,]*}} %[[b]])30// X64: call void @"??1A@@QEAA@XZ"(ptr {{[^,]*}} %[[c]])31// X64: ret void32 33 34void call_foo() {35  foo(A(1), A(2), A(3));36}37 38// Order of evaluation should be right to left, and we should clean up the right39// things as we unwind.40//41// X86-LABEL: define dso_local void @"?call_foo@@YAXXZ"()42// X86: call ptr @llvm.stacksave.p0()43// X86: %[[argmem:[^ ]*]] = alloca inalloca [[argmem_ty]]44// X86: %[[arg3:[^ ]*]] = getelementptr inbounds nuw [[argmem_ty]], ptr %[[argmem]], i32 0, i32 245// X86: call x86_thiscallcc noundef ptr @"??0A@@QAE@H@Z"(ptr {{[^,]*}} %[[arg3]], i32 noundef 3)46// X86: %[[arg2:[^ ]*]] = getelementptr inbounds nuw [[argmem_ty]], ptr %[[argmem]], i32 0, i32 147// X86: invoke x86_thiscallcc noundef ptr @"??0A@@QAE@H@Z"(ptr {{[^,]*}} %[[arg2]], i32 noundef 2)48// X86: %[[arg1:[^ ]*]] = getelementptr inbounds nuw [[argmem_ty]], ptr %[[argmem]], i32 0, i32 049// X86: invoke x86_thiscallcc noundef ptr @"??0A@@QAE@H@Z"(ptr {{[^,]*}} %[[arg1]], i32 noundef 1)50// X86: call void @"?foo@@YAXUA@@00@Z"(ptr inalloca([[argmem_ty]]) %[[argmem]])51// X86: call void @llvm.stackrestore.p052// X86: ret void53//54//   lpad2:55// X86: cleanuppad within none []56// X86: call x86_thiscallcc void @"??1A@@QAE@XZ"(ptr {{[^,]*}} %[[arg2]])57// X86: cleanupret58//59//   ehcleanup:60// X86: call x86_thiscallcc void @"??1A@@QAE@XZ"(ptr {{[^,]*}} %[[arg3]])61 62// X64-LABEL: define dso_local void @"?call_foo@@YAXXZ"()63// X64: call noundef ptr @"??0A@@QEAA@H@Z"(ptr {{[^,]*}} %[[arg3:[^,]*]], i32 noundef 3)64// X64: invoke noundef ptr @"??0A@@QEAA@H@Z"(ptr {{[^,]*}} %[[arg2:[^,]*]], i32 noundef 2)65// X64: invoke noundef ptr @"??0A@@QEAA@H@Z"(ptr {{[^,]*}} %[[arg1:[^,]*]], i32 noundef 1)66// X64: call void @"?foo@@YAXUA@@00@Z"67// X64:       (ptr dead_on_return noundef %[[arg1]], ptr dead_on_return noundef %[[arg2]], ptr dead_on_return noundef %[[arg3]])68// X64: ret void69//70//   lpad2:71// X64: cleanuppad within none []72// X64: call void @"??1A@@QEAA@XZ"(ptr {{[^,]*}} %[[arg2]])73// X64: cleanupret74//75//   ehcleanup:76// X64: call void @"??1A@@QEAA@XZ"(ptr {{[^,]*}} %[[arg3]])77