<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/96047>96047</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[mlir] Do not generate sizeof expressions using GEP
</td>
</tr>
<tr>
<th>Labels</th>
<td>
mlir
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
nikic
</td>
</tr>
</table>
<pre>
Lowering MemRef to LLVM dialect currently generates `ptrtoint (getelementptr null, 1)` style sizeof expressions using this helper:
https://github.com/llvm/llvm-project/blob/cfb4dce90ce66acbd094e443f422c4e5c413a9e8/mlir/lib/Conversion/LLVMCommon/Pattern.cpp#L171-L184
These need to be replaced with an emission of a constant based on the DataLayout.
The ability to generate the expressions in this form will go away entirely with https://discourse.llvm.org/t/rfc-replacing-getelementptr-with-ptradd/68699 and causes problems for https://discourse.llvm.org/t/rfc-remove-most-constant-expressions/63179 as well.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUk82upDYQhZ_GbEq0jPlpvGAxuR2y6ZFGUZS9fwpwYmxkF7fTefoIWjczEymL2YC8qFOnvqqjcnZzQBxY-xNrb4XaaYlpCO5PZwod7XO4xwcmF2b4jOuvOAFFuN9__wzWKY-GwOwpYSD_hBkDJkWYgXV8o0TRBQIm-hkJPa4YaKMEYfeeiTeomJCs45Dp6RGy-xvjBPjXljBnF0OGPR9taXEZFvQbJlZ_YvzG-KeFaMvHS4xMjLOjZdcXE1cmRu_fP37lluIfaIiJUfuomRjNpBtrUHKDXaeMtlw22DT11AhhGmxNU9VKYs_EuHqXDh131L3F8I7pcMXEeEz_Ftf1fHxRRJjCxWwbE_W9ulblveqbl83X97cFM0JAtAc7jZBw88qghYejBVQAXN05MsQJFJgYMqlAoFVGCzEALQg3RequnnGny3_EQWnnHT0P9Y8VnCXfsnThBXKKaYWH8x7mCOqhnoCBXEL_fLn5nqx12cQ9ZbwcPC8xzUyMB880mfI1hgtz-d1-y0On3Cgpa5kYu76TElSwYNSeMcOWova4nlZ-rN0a37FcY6byA1H5zYhHr7q6SlAZHuj9pbBDbWUtVYFDda36a9_3rSyWQfVoOlVfNe8n3XHOa8F5bbiZtJrqShduEFw0vKskl4K38mJ7IdtWWN1MEjvbs4bjqpz_12fhct5xkB1vroVXGn0-EyXE647Eka00nFep9zmzhnuXKX8VIEf-TOFZ0N7gFiFE-rrR_w3ILz9_Kfbkhx8Oxen54Pay_T6IfwIAAP__CV9a0Q">