llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang Author: adams381 <details> <summary>Changes</summary> Add three test files for CIR ABI parity on x86_64, all with CIR/LLVM/OGCG checks: - uncopyable-args.cpp — 24 functions covering non-copyable and move-only types (trivial, default-ctor, move-ctor, etc.) - x86_64-arguments.cpp — 26 functions covering C++ struct passing, inheritance, member pointers, empty bases, packed structs - attr-noundef.cpp — 26 functions covering noundef placement on structs, unions, vectors, member pointers, _BitInt Made with [Cursor](https://cursor.com) --- Patch is 30.56 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/191259.diff 3 Files Affected: - (added) clang/test/CIR/CodeGen/attr-noundef.cpp (+235) - (added) clang/test/CIR/CodeGenCXX/uncopyable-args.cpp (+464) - (added) clang/test/CIR/CodeGenCXX/x86_64-arguments.cpp (+252) ``````````diff diff --git a/clang/test/CIR/CodeGen/attr-noundef.cpp b/clang/test/CIR/CodeGen/attr-noundef.cpp new file mode 100644 index 0000000000000..3d133441ad5a0 --- /dev/null +++ b/clang/test/CIR/CodeGen/attr-noundef.cpp @@ -0,0 +1,235 @@ +// RUN: %clang_cc1 -triple x86_64-gnu-linux -x c++ -fclangir -emit-cir %s -o %t.cir +// RUN: FileCheck --check-prefix=CIR --input-file=%t.cir %s +// RUN: %clang_cc1 -triple x86_64-gnu-linux -x c++ -fclangir -emit-llvm %s -o %t-cir.ll +// RUN: FileCheck --check-prefix=LLVM --input-file=%t-cir.ll %s +// RUN: %clang_cc1 -triple x86_64-gnu-linux -x c++ -emit-llvm %s -o %t.ll +// RUN: FileCheck --check-prefix=OGCG --input-file=%t.ll %s + +// All cases from CodeGen/attr-noundef.cpp (x86_64 only). +// Tests noundef placement on structs, unions, this pointers, vectors, +// function/array pointers, member pointers, nullptr_t, and _BitInt. + +//************ Passing structs by value + +namespace check_structs { +struct Trivial { + int a; +}; +Trivial ret_trivial() { return {}; } +void pass_trivial(Trivial e) {} + +// CIR-LABEL: cir.func {{.*}} @_ZN13check_structs11ret_trivialEv +// CIR-LABEL: cir.func {{.*}} @_ZN13check_structs12pass_trivialENS_7TrivialE + +// LLVM-LABEL: define {{.*}} @_ZN13check_structs11ret_trivialEv( +// LLVM-LABEL: define {{.*}} void @_ZN13check_structs12pass_trivialENS_7TrivialE( + +// OGCG: define{{.*}} i32 @_ZN13check_structs11ret_trivialEv +// OGCG: define{{.*}} void @_ZN13check_structs12pass_trivialENS_7TrivialE{{.*}}(i32 % + +struct NoCopy { + int a; + NoCopy(NoCopy &) = delete; +}; +NoCopy ret_nocopy() { return {}; } +void pass_nocopy(NoCopy e) {} + +// CIR-LABEL: cir.func {{.*}} @_ZN13check_structs10ret_nocopyEv +// CIR-LABEL: cir.func {{.*}} @_ZN13check_structs11pass_nocopyENS_6NoCopyE + +// LLVM-LABEL: define {{.*}} @_ZN13check_structs10ret_nocopyEv( +// LLVM-LABEL: define {{.*}} void @_ZN13check_structs11pass_nocopyENS_6NoCopyE( + +// OGCG: define{{.*}} void @_ZN13check_structs10ret_nocopyEv{{.*}}(ptr dead_on_unwind noalias writable sret({{[^)]+}}) align 4 % +// OGCG: define{{.*}} void @_ZN13check_structs11pass_nocopyENS_6NoCopyE{{.*}}(ptr noundef dead_on_return % + +struct Huge { + int a[1024]; +}; +Huge ret_huge() { return {}; } +void pass_huge(Huge h) {} + +// CIR-LABEL: cir.func {{.*}} @_ZN13check_structs8ret_hugeEv +// CIR-LABEL: cir.func {{.*}} @_ZN13check_structs9pass_hugeENS_4HugeE + +// LLVM-LABEL: define {{.*}} @_ZN13check_structs8ret_hugeEv( +// LLVM-LABEL: define {{.*}} void @_ZN13check_structs9pass_hugeENS_4HugeE( + +// OGCG: define{{.*}} void @_ZN13check_structs8ret_hugeEv{{.*}}(ptr dead_on_unwind noalias writable sret({{[^)]+}}) align 4 % +// OGCG: define{{.*}} void @_ZN13check_structs9pass_hugeENS_4HugeE{{.*}}(ptr noundef +} // namespace check_structs + +//************ Passing unions by value + +namespace check_unions { +union Trivial { + int a; +}; +Trivial ret_trivial() { return {}; } +void pass_trivial(Trivial e) {} + +// CIR-LABEL: cir.func {{.*}} @_ZN12check_unions11ret_trivialEv +// CIR-LABEL: cir.func {{.*}} @_ZN12check_unions12pass_trivialENS_7TrivialE + +// LLVM-LABEL: define {{.*}} @_ZN12check_unions11ret_trivialEv( +// LLVM-LABEL: define {{.*}} void @_ZN12check_unions12pass_trivialENS_7TrivialE( + +// OGCG: define{{.*}} i32 @_ZN12check_unions11ret_trivialEv +// OGCG: define{{.*}} void @_ZN12check_unions12pass_trivialENS_7TrivialE{{.*}}(i32 % + +union NoCopy { + int a; + NoCopy(NoCopy &) = delete; +}; +NoCopy ret_nocopy() { return {}; } +void pass_nocopy(NoCopy e) {} + +// CIR-LABEL: cir.func {{.*}} @_ZN12check_unions10ret_nocopyEv +// CIR-LABEL: cir.func {{.*}} @_ZN12check_unions11pass_nocopyENS_6NoCopyE + +// LLVM-LABEL: define {{.*}} @_ZN12check_unions10ret_nocopyEv( +// LLVM-LABEL: define {{.*}} void @_ZN12check_unions11pass_nocopyENS_6NoCopyE( + +// OGCG: define{{.*}} void @_ZN12check_unions10ret_nocopyEv{{.*}}(ptr dead_on_unwind noalias writable sret({{[^)]+}}) align 4 % +// OGCG: define{{.*}} void @_ZN12check_unions11pass_nocopyENS_6NoCopyE{{.*}}(ptr noundef dead_on_return % +} // namespace check_unions + +//************ Passing `this` pointers + +namespace check_this { +struct Object { + int data[]; + + Object() { + this->data[0] = 0; + } + int getData() { + return this->data[0]; + } + Object *getThis() { + return this; + } +}; + +void use_object() { + Object obj; + obj.getData(); + obj.getThis(); +} + +// CIR-LABEL: cir.func {{.*}} @_ZN10check_this10use_objectEv +// CIR: cir.call @_ZN10check_this6ObjectC1Ev +// CIR: cir.call @_ZN10check_this6Object7getDataEv +// CIR: cir.call @_ZN10check_this6Object7getThisEv + +// this pointer: noundef nonnull dereferenceable align +// LLVM: define linkonce_odr void @_ZN10check_this6Object{{.*}}(ptr noundef nonnull align 4 dereferenceable(1) % +// LLVM: define linkonce_odr noundef i32 @_ZN10check_this6Object7getDataEv(ptr noundef nonnull align 4 dereferenceable(1) % +// LLVM: define linkonce_odr noundef ptr @_ZN10check_this6Object7getThisEv(ptr noundef nonnull align 4 dereferenceable(1) % + +// OGCG: define linkonce_odr void @_ZN10check_this6ObjectC1Ev(ptr noundef nonnull align 4 dereferenceable(1) % +// OGCG: define linkonce_odr noundef i32 @_ZN10check_this6Object7getDataEv(ptr noundef nonnull align 4 dereferenceable(1) % +// OGCG: define linkonce_odr noundef ptr @_ZN10check_this6Object7getThisEv(ptr noundef nonnull align 4 dereferenceable(1) % +} // namespace check_this + +//************ Passing vector types + +namespace check_vecs { +typedef int __attribute__((vector_size(12))) i32x3; +i32x3 ret_vec() { + return {}; +} +void pass_vec(i32x3 v) { +} + +// CIR-LABEL: cir.func {{.*}} @_ZN10check_vecs7ret_vecEv +// CIR-LABEL: cir.func {{.*}} @_ZN10check_vecs8pass_vecEDv3_i + +// LLVM: define {{.*}} noundef <3 x i32> @_ZN10check_vecs7ret_vecEv( +// LLVM: define {{.*}} void @_ZN10check_vecs8pass_vecEDv3_i(<3 x i32> noundef % + +// OGCG: define {{.*}} noundef <3 x i32> @_ZN10check_vecs7ret_vecEv( +// OGCG: define {{.*}} void @_ZN10check_vecs8pass_vecEDv3_i(<3 x i32> noundef % +} // namespace check_vecs + +//************ Passing exotic types + +namespace check_exotic { +struct Object { + int mfunc(); + int mdata; +}; +typedef int Object::*mdptr; +typedef int (Object::*mfptr)(); +typedef decltype(nullptr) nullptr_t; +typedef int (*arrptr)[32]; +typedef int (*fnptr)(int); + +arrptr ret_arrptr() { + return nullptr; +} +fnptr ret_fnptr() { + return nullptr; +} +mdptr ret_mdptr() { + return nullptr; +} +mfptr ret_mfptr() { + return nullptr; +} +nullptr_t ret_npt() { + return nullptr; +} +void pass_npt(nullptr_t t) { +} +_BitInt(3) ret_BitInt() { + return 0; +} +void pass_BitInt(_BitInt(3) e) { +} +void pass_large_BitInt(_BitInt(127) e) { +} + +// Pointers to arrays/functions: always noundef +// CIR-LABEL: cir.func {{.*}} @_ZN12check_exotic10ret_arrptrEv +// CIR-LABEL: cir.func {{.*}} @_ZN12check_exotic9ret_fnptrEv + +// LLVM: define {{.*}} noundef ptr @_ZN12check_exotic10ret_arrptrEv( +// LLVM: define {{.*}} noundef ptr @_ZN12check_exotic9ret_fnptrEv( + +// OGCG: define {{.*}} noundef ptr @_ZN12check_exotic10ret_arrptrEv( +// OGCG: define {{.*}} noundef ptr @_ZN12check_exotic9ret_fnptrEv( + +// Member pointers: never noundef +// CIR-LABEL: cir.func {{.*}} @_ZN12check_exotic9ret_mdptrEv +// CIR-LABEL: cir.func {{.*}} @_ZN12check_exotic9ret_mfptrEv + +// LLVM: define {{.*}} i64 @_ZN12check_exotic9ret_mdptrEv( +// LLVM: define {{.*}} { i64, i64 } @_ZN12check_exotic9ret_mfptrEv( + +// OGCG: define {{.*}} i64 @_ZN12check_exotic9ret_mdptrEv( +// OGCG: define {{.*}} { i64, i64 } @_ZN12check_exotic9ret_mfptrEv( + +// nullptr_t: never noundef +// CIR-LABEL: cir.func {{.*}} @_ZN12check_exotic7ret_nptEv +// CIR-LABEL: cir.func {{.*}} @_ZN12check_exotic8pass_nptEDn + +// LLVM: define {{.*}} ptr @_ZN12check_exotic7ret_nptEv( +// LLVM: define {{.*}} void @_ZN12check_exotic8pass_nptEDn(ptr % + +// OGCG: define {{.*}} ptr @_ZN12check_exotic7ret_nptEv( +// OGCG: define {{.*}} void @_ZN12check_exotic8pass_nptEDn(ptr % + +// _BitInt types +// CIR-LABEL: cir.func {{.*}} @_ZN12check_exotic10ret_BitIntEv +// CIR-LABEL: cir.func {{.*}} @_ZN12check_exotic11pass_BitIntEDB3_ +// CIR-LABEL: cir.func {{.*}} @_ZN12check_exotic17pass_large_BitIntEDB127_ + +// LLVM: define {{.*}} i3 @_ZN12check_exotic10ret_BitIntEv( +// LLVM: define {{.*}} void @_ZN12check_exotic11pass_BitIntEDB3_(i3 % +// LLVM: define {{.*}} void @_ZN12check_exotic17pass_large_BitIntEDB127_(i127 % + +// OGCG: define {{.*}} noundef signext i3 @_ZN12check_exotic10ret_BitIntEv( +// OGCG: define {{.*}} void @_ZN12check_exotic11pass_BitIntEDB3_(i3 noundef signext % +// OGCG: define {{.*}} void @_ZN12check_exotic17pass_large_BitIntEDB127_(i64 noundef %{{.*}}, i64 noundef % +} // namespace check_exotic diff --git a/clang/test/CIR/CodeGenCXX/uncopyable-args.cpp b/clang/test/CIR/CodeGenCXX/uncopyable-args.cpp new file mode 100644 index 0000000000000..48e954d9e72f3 --- /dev/null +++ b/clang/test/CIR/CodeGenCXX/uncopyable-args.cpp @@ -0,0 +1,464 @@ +// RUN: %clang_cc1 -std=c++11 -triple x86_64-unknown-unknown -fclangir -emit-cir %s -o %t.cir +// RUN: FileCheck --check-prefix=CIR --input-file=%t.cir %s +// RUN: %clang_cc1 -std=c++11 -triple x86_64-unknown-unknown -fclangir -emit-llvm %s -o %t-cir.ll +// RUN: FileCheck --check-prefix=LLVM --input-file=%t-cir.ll %s +// RUN: %clang_cc1 -std=c++11 -triple x86_64-unknown-unknown -emit-llvm %s -o %t.ll +// RUN: FileCheck --check-prefix=OGCG --input-file=%t.ll %s + +// All test cases from CodeGenCXX/uncopyable-args.cpp (Itanium x86_64 only). +// Tests CIRGen handling of types with deleted/defaulted/implicit copy/move ctors. + +namespace trivial { +struct A { + void *p; +}; +void foo(A); +void bar() { + foo({}); +} +// CIR-LABEL: cir.func {{.*}} @_ZN7trivial3barEv +// CIR: cir.call @_ZN7trivial3fooENS_1AE + +// LLVM-LABEL: define {{.*}} void @_ZN7trivial3barEv( +// LLVM: call void @_ZN7trivial3fooENS_1AE( + +// OGCG-LABEL: define {{.*}} void @_ZN7trivial3barEv( +// OGCG: call void @_ZN7trivial3fooENS_1AE(ptr +} + +namespace default_ctor { +struct A { + A(); + void *p; +}; +void foo(A); +void bar() { + foo({}); +} +// CIR-LABEL: cir.func {{.*}} @_ZN12default_ctor3barEv +// CIR: cir.call @_ZN12default_ctor1AC1Ev +// CIR: cir.call @_ZN12default_ctor3fooENS_1AE + +// LLVM-LABEL: define {{.*}} void @_ZN12default_ctor3barEv( +// LLVM: call void @_ZN12default_ctor1AC1Ev( +// LLVM: call void @_ZN12default_ctor3fooENS_1AE( + +// OGCG-LABEL: define {{.*}} void @_ZN12default_ctor3barEv( +// OGCG: call {{.*}} @_ZN12default_ctor1AC1Ev( +// OGCG: call void @_ZN12default_ctor3fooENS_1AE(ptr +} + +namespace move_ctor { +struct A { + A(); + A(A &&o); + void *p; +}; +void foo(A); +void bar() { + foo({}); +} +// CIR-LABEL: cir.func {{.*}} @_ZN9move_ctor3barEv +// CIR: cir.call @_ZN9move_ctor1AC1Ev +// CIR: cir.call @_ZN9move_ctor3fooENS_1AE + +// LLVM-LABEL: define {{.*}} void @_ZN9move_ctor3barEv( +// LLVM: call void @_ZN9move_ctor1AC1Ev( +// LLVM: call void @_ZN9move_ctor3fooENS_1AE( + +// OGCG-LABEL: define {{.*}} void @_ZN9move_ctor3barEv( +// OGCG: call {{.*}} @_ZN9move_ctor1AC1Ev( +// OGCG: call void @_ZN9move_ctor3fooENS_1AE(ptr noundef dead_on_return +} + +namespace all_deleted { +struct A { + A(); + A(const A &o) = delete; + A(A &&o) = delete; + void *p; +}; +void foo(A); +void bar() { + foo({}); +} +// CIR-LABEL: cir.func {{.*}} @_ZN11all_deleted3barEv +// CIR: cir.call @_ZN11all_deleted1AC1Ev +// CIR: cir.call @_ZN11all_deleted3fooENS_1AE + +// LLVM-LABEL: define {{.*}} void @_ZN11all_deleted3barEv( +// LLVM: call void @_ZN11all_deleted1AC1Ev( +// LLVM: call void @_ZN11all_deleted3fooENS_1AE( + +// OGCG-LABEL: define {{.*}} void @_ZN11all_deleted3barEv( +// OGCG: call {{.*}} @_ZN11all_deleted1AC1Ev( +// OGCG: call void @_ZN11all_deleted3fooENS_1AE(ptr noundef dead_on_return +} + +namespace implicitly_deleted { +struct A { + A(); + A &operator=(A &&o); + void *p; +}; +void foo(A); +void bar() { + foo({}); +} +// CIR-LABEL: cir.func {{.*}} @_ZN18implicitly_deleted3barEv +// CIR: cir.call @_ZN18implicitly_deleted1AC1Ev +// CIR: cir.call @_ZN18implicitly_deleted3fooENS_1AE + +// LLVM-LABEL: define {{.*}} void @_ZN18implicitly_deleted3barEv( +// LLVM: call void @_ZN18implicitly_deleted1AC1Ev( +// LLVM: call void @_ZN18implicitly_deleted3fooENS_1AE( + +// OGCG-LABEL: define {{.*}} void @_ZN18implicitly_deleted3barEv( +// OGCG: call {{.*}} @_ZN18implicitly_deleted1AC1Ev( +// OGCG: call void @_ZN18implicitly_deleted3fooENS_1AE(ptr noundef dead_on_return +} + +namespace one_deleted { +struct A { + A(); + A(A &&o) = delete; + void *p; +}; +void foo(A); +void bar() { + foo({}); +} +// CIR-LABEL: cir.func {{.*}} @_ZN11one_deleted3barEv +// CIR: cir.call @_ZN11one_deleted1AC1Ev +// CIR: cir.call @_ZN11one_deleted3fooENS_1AE + +// LLVM-LABEL: define {{.*}} void @_ZN11one_deleted3barEv( +// LLVM: call void @_ZN11one_deleted1AC1Ev( +// LLVM: call void @_ZN11one_deleted3fooENS_1AE( + +// OGCG-LABEL: define {{.*}} void @_ZN11one_deleted3barEv( +// OGCG: call {{.*}} @_ZN11one_deleted1AC1Ev( +// OGCG: call void @_ZN11one_deleted3fooENS_1AE(ptr noundef dead_on_return +} + +namespace copy_defaulted { +struct A { + A(); + A(const A &o) = default; + A(A &&o) = delete; + void *p; +}; +void foo(A); +void bar() { + foo({}); +} +// CIR-LABEL: cir.func {{.*}} @_ZN14copy_defaulted3barEv +// CIR: cir.call @_ZN14copy_defaulted1AC1Ev +// CIR: cir.call @_ZN14copy_defaulted3fooENS_1AE + +// LLVM-LABEL: define {{.*}} void @_ZN14copy_defaulted3barEv( +// LLVM: call void @_ZN14copy_defaulted1AC1Ev( +// LLVM: call void @_ZN14copy_defaulted3fooENS_1AE( + +// OGCG-LABEL: define {{.*}} void @_ZN14copy_defaulted3barEv( +// OGCG: call {{.*}} @_ZN14copy_defaulted1AC1Ev( +// OGCG: call void @_ZN14copy_defaulted3fooENS_1AE(ptr +} + +namespace move_defaulted { +struct A { + A(); + A(const A &o) = delete; + A(A &&o) = default; + void *p; +}; +void foo(A); +void bar() { + foo({}); +} +// CIR-LABEL: cir.func {{.*}} @_ZN14move_defaulted3barEv +// CIR: cir.call @_ZN14move_defaulted1AC1Ev +// CIR: cir.call @_ZN14move_defaulted3fooENS_1AE + +// LLVM-LABEL: define {{.*}} void @_ZN14move_defaulted3barEv( +// LLVM: call void @_ZN14move_defaulted1AC1Ev( +// LLVM: call void @_ZN14move_defaulted3fooENS_1AE( + +// OGCG-LABEL: define {{.*}} void @_ZN14move_defaulted3barEv( +// OGCG: call {{.*}} @_ZN14move_defaulted1AC1Ev( +// OGCG: call void @_ZN14move_defaulted3fooENS_1AE(ptr +} + +namespace trivial_defaulted { +struct A { + A(); + A(const A &o) = default; + void *p; +}; +void foo(A); +void bar() { + foo({}); +} +// CIR-LABEL: cir.func {{.*}} @_ZN17trivial_defaulted3barEv +// CIR: cir.call @_ZN17trivial_defaulted1AC1Ev +// CIR: cir.call @_ZN17trivial_defaulted3fooENS_1AE + +// LLVM-LABEL: define {{.*}} void @_ZN17trivial_defaulted3barEv( +// LLVM: call void @_ZN17trivial_defaulted1AC1Ev( +// LLVM: call void @_ZN17trivial_defaulted3fooENS_1AE( + +// OGCG-LABEL: define {{.*}} void @_ZN17trivial_defaulted3barEv( +// OGCG: call {{.*}} @_ZN17trivial_defaulted1AC1Ev( +// OGCG: call void @_ZN17trivial_defaulted3fooENS_1AE(ptr +} + +namespace two_copy_ctors { +struct A { + A(); + A(const A &) = default; + A(const A &, int = 0); + void *p; +}; +struct B : A {}; + +void foo(B); +void bar() { + foo({}); +} +// CIR-LABEL: cir.func {{.*}} @_ZN14two_copy_ctors3barEv +// CIR: cir.call @{{.*}}C1Ev +// CIR: cir.call @_ZN14two_copy_ctors3fooENS_1BE + +// LLVM-LABEL: define {{.*}} void @_ZN14two_copy_ctors3barEv( +// LLVM: call void @{{.*}}C1Ev( +// LLVM: call void @_ZN14two_copy_ctors3fooENS_1BE( + +// OGCG-LABEL: define {{.*}} void @_ZN14two_copy_ctors3barEv( +// OGCG: call {{.*}} @{{.*}}C1Ev( +// OGCG: call void @_ZN14two_copy_ctors3fooENS_1BE(ptr noundef dead_on_return +} + +namespace definition_only { +struct A { + A(); + A(A &&o); + void *p; +}; +void *foo(A a) { return a.p; } + +// CIR-LABEL: cir.func {{.*}} @_ZN15definition_only3fooENS_1AE +// CIR: cir.return + +// LLVM-LABEL: define {{.*}} @_ZN15definition_only3fooENS_1AE( +// LLVM: ret + +// OGCG-LABEL: define {{.*}} ptr @_ZN15definition_only3fooENS_1AE(ptr +// OGCG: ret ptr +} + +namespace deleted_by_member { +struct B { + B(); + B(B &&o); + void *p; +}; +struct A { + A(); + B b; +}; +void *foo(A a) { return a.b.p; } + +// CIR-LABEL: cir.func {{.*}} @_ZN17deleted_by_member3fooENS_1AE +// CIR: cir.return + +// LLVM-LABEL: define {{.*}} @_ZN17deleted_by_member3fooENS_1AE( +// LLVM: ret + +// OGCG-LABEL: define {{.*}} ptr @_ZN17deleted_by_member3fooENS_1AE(ptr +// OGCG: ret ptr +} + +namespace deleted_by_base { +struct B { + B(); + B(B &&o); + void *p; +}; +struct A : B { + A(); +}; +void *foo(A a) { return a.p; } + +// CIR-LABEL: cir.func {{.*}} @_ZN15deleted_by_base3fooENS_1AE +// CIR: cir.return + +// LLVM-LABEL: define {{.*}} @_ZN15deleted_by_base3fooENS_1AE( +// LLVM: ret + +// OGCG-LABEL: define {{.*}} ptr @_ZN15deleted_by_base3fooENS_1AE(ptr +// OGCG: ret ptr +} + +namespace deleted_by_member_copy { +struct B { + B(); + B(const B &o) = delete; + void *p; +}; +struct A { + A(); + B b; +}; +void *foo(A a) { return a.b.p; } + +// CIR-LABEL: cir.func {{.*}} @_ZN22deleted_by_member_copy3fooENS_1AE +// CIR: cir.return + +// LLVM-LABEL: define {{.*}} @_ZN22deleted_by_member_copy3fooENS_1AE( +// LLVM: ret + +// OGCG-LABEL: define {{.*}} ptr @_ZN22deleted_by_member_copy3fooENS_1AE(ptr +// OGCG: ret ptr +} + +namespace deleted_by_base_copy { +struct B { + B(); + B(const B &o) = delete; + void *p; +}; +struct A : B { + A(); +}; +void *foo(A a) { return a.p; } + +// CIR-LABEL: cir.func {{.*}} @_ZN20deleted_by_base_copy3fooENS_1AE +// CIR: cir.return + +// LLVM-LABEL: define {{.*}} @_ZN20deleted_by_base_copy3fooENS_1AE( +// LLVM: ret + +// OGCG-LABEL: define {{.*}} ptr @_ZN20deleted_by_base_copy3fooENS_1AE(ptr +// OGCG: ret ptr +} + +namespace explicit_delete { +struct A { + A(); + A(const A &o) = delete; + void *p; +}; +void *foo(A a) { return a.p; } + +// CIR-LABEL: cir.func {{.*}} @_ZN15explicit_delete3fooENS_1AE +// CIR: cir.return + +// LLVM-LABEL: define {{.*}} @_ZN15explicit_delete3fooENS_1AE( +// LLVM: ret + +// OGCG-LABEL: define {{.*}} ptr @_ZN15explicit_delete3fooENS_1AE(ptr +// OGCG: ret ptr +} + +namespace implicitly_deleted_copy_ctor { +struct A { + A &operator=(const A&); + int &&ref; +}; +int &foo(A a) { return a.ref; } + +// CIR-LABEL: cir.func {{.*}} @_ZN28implicitly_deleted_copy_ctor3fooENS_1AE +// CIR: cir.return + +// LLVM-LABEL: define {{.*}} @_ZN28implicitly_deleted_copy_ctor3fooENS_1AE( +// LLVM: ret + +// OGCG-LABEL: define {{.*}} @_ZN28implicitly_deleted_copy_ctor3fooENS_1AE(ptr +// OGCG: ret ptr + +struct B { + B &operator=(const B&); + int &ref; +}; +int &foo(B b) { return b.ref; } + +// CIR-LABEL: cir.func {{.*}} @_ZN28implicitly_deleted_copy_ctor3fooENS_1BE +// CIR: cir.return + +// LLVM-LABEL: define {{.*}} @_ZN28implicitly_deleted_copy_ctor3fooENS_1BE( +// LLVM: ret + +// OGCG-LABEL: define {{.*}} @_ZN28implicitly_deleted_copy_ctor3fooENS_1BE(ptr +// OGCG: ret ptr + +struct X { X(const X&); }; +struct Y { Y(const Y&) = default; }; + +union C { + C &operator=(const C&); + X x; + int n; +}; +int foo(C c) { return c.n; } + +// CIR-LABEL: cir.func {{.*}} @_ZN28implicitly_deleted_copy_ctor3fooENS_1CE +// CIR: cir.return + +// LLVM-LABEL: define {{.*}} @_ZN28implicitly_deleted_copy_ctor3fooENS_1CE( +// LLVM: ret + +// OGCG-LABEL: define {{.*}} @_ZN28implicitly_deleted_copy_ctor3fooENS_1CE(ptr +// OGCG: ret i32 + +struct D { + D &operator=(const D&); + union { + X x; + int n; + }; +}; +int foo(D d) { return d.n; } + +// CIR-LABEL: cir.func {{.*}} @_ZN28implicitly_deleted_copy_ctor3fooENS_1DE +// CIR: cir.return + +// LLVM-LABEL: define {{.*}} @_ZN28implicitly_deleted_copy_ctor3fooENS_1DE( +// LLVM: ret + +// OGCG-LABEL: define {{.*}} @_ZN28implicitly_deleted_copy_ctor3fooENS_1DE(ptr +// OGCG: ret i32 + +union E { + E &operator=(const E&); + Y y; + int n; +}; +int foo(E e) { return e.n; } + +// CIR-LABEL: cir.func {{.*}} @_ZN28implicitly_deleted_copy_ctor3fooENS_1EE +// CIR: cir.return + +// LLVM-LABEL: define {{.*}} @_ZN28implicitly_deleted_copy_ctor3fooENS_1EE( +// LLVM: ret + +// OGCG-LABEL: define {{.*}} i32 @_ZN28implicitly_deleted_copy_ctor3fooENS_1EE(i32 +// OGCG: ret i32 + +struct F { + F &operator=(const F&); + u... [truncated] `````````` </details> https://github.com/llvm/llvm-project/pull/191259 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
