================ @@ -0,0 +1,21 @@ +// RUN: %clang_cc1 -triple x86_64-pc-windows-msvc -std=c++11 -fcxx-exceptions -fexceptions -emit-llvm -o - %s | FileCheck %s + +// CHECK: %[[STRUCT_TRIVIAL:.*]] = type { ptr } +struct __attribute__((trivial_abi)) Trivial { + int *p; + Trivial() : p(0) {} + Trivial(const Trivial &) noexcept = default; +}; + +// CHECK-LABEL: define{{.*}} i64 @"?retTrivial@@YA?AUTrivial@@XZ"( +// CHECK: %retval = alloca %[[STRUCT_TRIVIAL]], align 8 +// CHECK: %call = call noundef ptr @"??0Trivial@@QEAA@XZ"(ptr noundef nonnull align 8 dereferenceable(8) %retval) +// CHECK: %coerce.dive = getelementptr inbounds %[[STRUCT_TRIVIAL]], ptr %retval, i32 0, i32 0 +// CHECK: %0 = load ptr, ptr %coerce.dive, align 8 +// CHECK: %coerce.val.pi = ptrtoint ptr %0 to i64 +// CHECK: ret i64 %coerce.val.pi +Trivial retTrivial() { + Trivial s; + return s; +} + ---------------- rnk wrote:
For completeness, please add the instance and static method return cases, since those are indirect for other reasons. For me, it's sufficient to check the function prototype, both of which should have an sret pointer: https://godbolt.org/z/fn7vrGrKh https://github.com/llvm/llvm-project/pull/88857 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits