<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/133599>133599</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[AIX] LLVM datalayout is incorrect unless overridden by clang
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
workingjubilee
</td>
</tr>
</table>
<pre>
Frontends for LLVM that offer support for the powerpc64-ibm-aix target but do not manually implement [the Clang patch that overrides the data layout](https://github.com/llvm/llvm-project/commit/05ad8e942996f36cc694478542ccd84aa5bbb80f), specifically [here](https://github.com/llvm/llvm-project/blob/d66af9c69b6960ad5f903cc6c0db99395dace6af/clang/lib/Basic/Targets/PPC.h#L406-L413), are using an incorrect data layout. This has resulted in hundreds of hours being wasted on trying to identify bugs due to incompatible layouts in those compilers, partially because of further conflation between the notion of alignment and "preferred" alignment, and the presence of a cryptically-worded "power alignment" rule in IBM's documentation.
As far as I can tell, the so-called "power alignment" rule, if Clang's implementation is correct, merely is a rule that the compiler should align the type on the stack using the "preferred" alignment. It has no other effect. **Even if this happens to affect parameter passing, and is thus required in that case for FFI correctness, then it is not a noteworthy distinction**: other ABIs have far more "interesting" ad-hoc on-stack alignment exceptions. Otherwise, compilers should not need to be told that they may wish to overalign things for their internal stack layouts if it seems performance would benefit, as that would hopefully be obvious.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJycVcmOGzcQ_RrqUpDQw16kPuigsSNggDHigxHkyqWops0mO1xG1t8HxZZmfEmA5DJLF1n16tWrR5GSvXjEI-ufWf95I0qeQjxeQ_xh_eV7kdYhbmTQt-M5Bp_R6wQmRHh9_eML5ElkCMZghFSWJcRcY3lCWMIV46KGbmvlvBX2J2QRL5hBlgw6gA8ZZuGLcO4Gdl4czugzsP6Zbn9ywl9gEVlN9yJvGKPVmGpyLbIAJ26hZNZ_Zvww5bwk1p4YPzN-vtg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