[clang] [clang][CodeGen] Fix MSVC ABI for HVA/HFA returns with vectorcall on x86 (PR #113104)

Eli Friedman via cfe-commits cfe-commits at lists.llvm.org
Sun Oct 18 11:57:13 PDT 2026


================
@@ -1195,6 +1195,19 @@ bool MicrosoftCXXABI::classifyReturnType(CGFunctionInfo &FI) const {
   // MSVC always returns structs indirectly from C++ instance methods.
   bool isIndirectReturn = !isTrivialForABI || FI.isInstanceMethod();
 
+  // With __vectorcall on x86, HVAs (including HFAs) that can be passed in
+  // registers are returned in vector registers, even if they are not C++14
+  // aggregates and even when returned from instance methods.
+  if (isIndirectReturn &&
+      FI.getCallingConvention() == llvm::CallingConv::X86_VectorCall &&
----------------
efriedma-quic wrote:

This is assuming X86_VectorCall implies the target is x86.  Which is a reasonable assumption; other targets shouldn't allow it.

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


More information about the cfe-commits mailing list