[PATCH] D49464: [COFF, ARM64] Mark only POD-type returns as SRET

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 17 18:50:00 PDT 2018


efriedma added inline comments.


================
Comment at: lib/CodeGen/CGCall.cpp:1988
+    if (getTarget().getTriple().isOSWindows() &&
+        getTarget().getTriple().getArch() == llvm::Triple::aarch64) {
+      const CXXRecordDecl *RD = FI.getReturnType()->getAsCXXRecordDecl();
----------------
We shouldn't be checking the triple here.  Can we extend CGFunctionInfo to record this instead, then perform the check in AArch64ABIInfo in lib/CodeGen/TargetInfo.cpp?


================
Comment at: lib/CodeGen/CGCall.cpp:1990
+      const CXXRecordDecl *RD = FI.getReturnType()->getAsCXXRecordDecl();
+      if (RD && RD->isPOD())
+        SRETAttrs.addAttribute(llvm::Attribute::StructRet);
----------------
Are you sure isPOD() is the right check?  I wouldn't trust the spec; for other Microsoft targets in other similar situations, we usually check whether the class has a trivial copy constructor, or something like that; see MicrosoftCXXABI::getRecordArgABI.


https://reviews.llvm.org/D49464





More information about the llvm-commits mailing list