<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/62281>62281</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Fatal Error in Backend When Using __builtin_matrix_transpose on Integral Matrix Type at All Non-zero Optimization Levels
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
dev-lunarosa
</td>
</tr>
</table>
<pre>
I am getting a fatal error in the backend of trunk when using `__builtin_matrix_transpose` on an integral matrix type at all non-zero optimization levels. See the C++ code below for an example:
using matrix_type = int __attribute__ ((matrix_type(2,2)));
auto foo (matrix_type a, matrix_type b, matrix_type c) {
return __builtin_matrix_transpose(a * b + c);
}
Note this only happens with integral-type matrices, and only when the argument to `__builtin_matrix_transpose` is of the form `a * b + c`. Arguments of the form `a`, `a * b`, and `a + c` do not cause the error. The result is the same if `b` and/or `c` are scalars. Optimization levels besides `-O0` seem to trigger the error.
Pretty much the same applies to non-square matrices. See the following for another example which causes the error:
using matrix2x4 = int __attribute__ ((matrix_type(2,4)));
using matrix4x2 = int __attribute__ ((matrix_type(4,2)));
using matrix2x2 = int __attribute__ ((matrix_type(2,2)));
auto foo (matrix2x4 a, matrix4x2 b, matrix2x2 c) {
return __builtin_matrix_transpose(a * b + c);
}
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy0VVGP2zYM_jXKC5HAll1f7sEPl7sFKLC1A9ZhjwFt07ZWWfIk-nLXXz_QcZZkXVfcgAVBEsjkx08kv3wYo-kcUane7dS7pxVO3PtQNvS8tpPD4COuKt-8lu8BB-iI2bgOEFpktEAh-ADGAfcEFdafyTXgW-Awuc9w7MnBFCVBFcnhUE3GsnGHATmYlwMHdHH0kVSRgHeADoxj6gJaOIUAv44EyIDWgvNu_YWCBz-yGcwXZOMdWHomGzfwC9FM4lHpndI7qH1DUJH1R2h9EGx6wWG0pLIHlTypZPkEgIXimZWUVNmTcIHDAZmDqSamwwGU3iq9vYpTequVftRK3y_vbHeBvfzCiT203sNtOqDSjzd1q78f1Erfg7q7QpVXIJ6Cg3_pqN4iKP0AFczNuKGm7p6uO_DBs7TORPDOvkKP40guwtFw_9c81jOZuUpNUUiiDFri5yFL5zF000COgf33xy3V2jmt9WGQ-Fu-RbKBhwXw61BVJMLhkrUcCKnl8AQCjQfnGWqc4mk_5o3dwKeeIFCcLAsVeRBxIDCt5AucYCm990EOZigMBLFGiyFu4OPXOwgVRdNQlIT1x0RSItEg7eBguo7CFYHrAfwciPkVhqnuL0xwHK2hKNmy-PGPSeqfJ3DZ99Zb64-yv6c199xTOO86HHtT96fbx0v170hAv-RvFED-zwK4Bs1f9BtA82-r6pbpW0D_o1SlHVdClYtcyVQo_E8iXTVl1txn97iiMi22OtkWRZau-rK4y99VuiJdZNjmRVZgm1aU5znWWdPU1cqUOtFZkus0zdO7NN1QmtQNFVVFSZZTlao8oQGN3Vj7PGx86FYmxonKQutturJYkY2zI2jt6AjzQ6W1GEQoJWddTV1UeWJN5HhBYcOWyv3sDT-cvWG3-MJv8k_x6zy-bzdFjOD92QV-OrnAp8UFHqyFD2cXuFHgj7MCV1OwZc88RtlwvVd63xnup2pT-0HpvdBcvtZj8L9TzUrv58tFpffz5f8MAAD__179RFw">