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

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 18 12:38:33 PDT 2018


efriedma added inline comments.


================
Comment at: lib/CodeGen/CGCall.cpp:1990
+      const CXXRecordDecl *RD = FI.getReturnType()->getAsCXXRecordDecl();
+      if (RD && RD->isPOD())
+        SRETAttrs.addAttribute(llvm::Attribute::StructRet);
----------------
yinma wrote:
> efriedma wrote:
> > 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.
> Do you have any information about why isPOD is not the right check? The POD definition is defined as the spec. I am seeing clang has many places to setup  PlainOldData = false. It doesn't look like it is just about testing constructor for me. 
Just verified, you're right, POD is actually the right check. It's just a bit weird because there isn't any technical reason for the calling convention code to check whether the class has, for example, a trivial default constructor.


https://reviews.llvm.org/D49464





More information about the llvm-commits mailing list