MSVC normally has a bunch of restrictions on returning values directly, which don't apply to passing values directly. (This roughly corresponds to the definition of a C++14 aggregate.) However, these restrictions don't apply to HVAs; make sure we check for that.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Restrict to AArch64.
Actually, it seems like something sort of similar happens with x86 vectorcall. But I haven't tried to test all the permutations of that, so don't modify the behavior for now.
Interesting. In Clang, we basically layer the C++ rules over the C rules: if C++ aspects of a class allow it to be passed directly transparently, then we defer down to the C rules, which deal with HVAs, structs, and things like that.
Can you file an issue for that and cc me?
clang/test/CodeGenCXX/homogeneous-aggregates.cpp | ||
---|---|---|
294 | Can you do the same test again with a non-vector field (double) for test coverage? | |
295 | Did you mean to inherit from base here to make a two-element HVA? |
Filed https://github.com/llvm/llvm-project/issues/63417 . (On a related note, I also filed https://github.com/llvm/llvm-project/issues/63360 for an issue I stumbled over involving deleted copy constructors.)
Interesting. In Clang, we basically layer the C++ rules over the C rules: if C++ aspects of a class allow it to be passed directly transparently, then we defer down to the C rules, which deal with HVAs, structs, and things like that.
Yes... clearly MSVC is doing something very different if they're getting results like this by accident.
The other thing I'm getting at here is that our TargetInfo.cpp abstraction is pretty well built out, even if it's a huge mess. The C++ rules are generally platform neutral, and we don't usually have to resort to these kinds of triple checks, but sometimes it's the most straightforward approach.
Can you do the same test again with a non-vector field (double) for test coverage?