<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/69394>69394</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang] __is_trivially_relocatable isn't correct on Windows
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang,
platform:windows,
clang-cl
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
rnk
</td>
</tr>
</table>
<pre>
As implemented in https://reviews.llvm.org/D119017 and https://reviews.llvm.org/D114732, the `__is_trivially_relocatable` type trait is built on top of `canPassInRegisters`, which was never meant to implement this type trait:
https://github.com/llvm/llvm-project/blob/e90ec58b132a7244bdd8d45dd482fd78fe487f37/clang/lib/AST/Type.cpp#L2649
`canPassInRegisters` is full of various size checks that have nothing to do with trivial relocatability:
https://github.com/llvm/llvm-project/blob/340d746abae18f6a69bdf4a3bbe4a46990bb755d/clang/lib/Sema/SemaDeclCXX.cpp#L6909-L6915
This means `__is_trivial_relocatability` doesn't work correctly on Windows or PS4.
There are extensive comments on the original review which I haven't read through, but it seems like the proper solution is to track trivial relocatability as a type trait, and then use that to inform whether things get passed in registers.
I think (at risk of misremembering) that I suggested the name of "canPassInRegisters", and what I think I had in mind is that we should name it something intentionally hyper-specific and low-level so that folks don't rely on it for any other purpose, but I guess that didn't work out as planned. I guess it wasn't that great of a plan in the first place.
cc @zygoloid @ssbr @zmodem @danakj
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyklc2O2zgMx59GuRAT2PJXfMhhtkGAAXootgW2t4FkMTYbWTJEOdn06ReyM9OZ7hbYxV4SQ6Io8sc_KcVMvUPci-o3UR02ao6DD_vgzhvtzW3_yEDjZHFEF9EAORhinFgUj0IehTwGvBBeeWvtZdz60At5POR5m-UNKGf-lXHZFFLIDxAHBFFnz8_EzzHQhZS1t-eA1ncqKm1R1BnE24QQg6IIxKBnshG8g-gn8Kd0vFPuk2J-cr9jTxwx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