[clang] [clang][CodeGen] Fix MSVC ABI for classes with non static data members of reference type (PR #90547)

Max Winkler via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 29 19:40:37 PDT 2024


================
@@ -1144,11 +1167,13 @@ bool MicrosoftCXXABI::classifyReturnType(CGFunctionInfo &FI) const {
   if (!RD)
     return false;
 
-  bool isTrivialForABI = RD->canPassInRegisters() &&
-                         isTrivialForMSVC(RD, FI.getReturnType(), CGM);
-
   // MSVC always returns structs indirectly from C++ instance methods.
-  bool isIndirectReturn = !isTrivialForABI || FI.isInstanceMethod();
+  bool isIndirectReturn = FI.isInstanceMethod();
----------------
MaxEW707 wrote:

I intentionally moved this around to try to reduce calling `isTrivialForMSVC` for methods and potentially now hitting the recursive field loop I added above.
Since methods always return indirectly we can avoid all these extra checks up front.

Let me know if you prefer this being a separate PR.

https://github.com/llvm/llvm-project/pull/90547


More information about the cfe-commits mailing list