<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/84178>84178</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Significant Increase in binary size and stack usage with clang 18.x
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
MarcoSpeziali
</td>
</tr>
</table>
<pre>
Greetings,
I've encountered a significant change in the behavior of `clang`'s `LLVM-IR` emission between versions, specifically when comparing the output of `clang` **17.0.1** with the **trunk** version for the `RISC-V rv32gc` target. The `IR` and the resultant `ELF` file sizes show a marked increase in the `.text` section size, with a difference of approximately 1200 bytes (from `0005e8` to `000a88`).
This issue is not confined to the `RISC-V` target alone. I have observed a similar pattern with a fork of the `llvm-project` (updated to the `release/18.x` branch two days ago) for our custom backend.
Furthermore, it appears that the `clang` version **18.x** and later are utilizing significantly more stack space, which has led to stack overflow errors in our testing environment (having just 2K of RAM).
For reference and further examination, I have provided an example here: https://godbolt.org/z/qeTae411h.
Could there have been changes in `clang`'s optimization strategies or `IR` emission patterns from version **17.0.1** to the `trunk` that might explain these observations? Any insights or suggestions on mitigating these issues (perhaps some new compilation flags)?
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxcVUtzozgQ_jXypWtcIPzi4IN3ZtlK7cwlSc29gQY0ERLbauw4v35LwnleEqv06K_7e4AhmN4RHdX2L7X9scJZBs_HX8iNf5joxaA1q9q31-M_TCTG9UHp7yr7obLT8vdO6f2ZgFzjZyfE1AJCfNR0pkEn0AzoegLjQAaCmgY8G8_gO1C7rLHoerXLlN6HuP758_evb3f3apcBjSYE4x3UJBciB2fiuI4AIEzUpALWXuEykIPGjxOycX0q42eZZvlSBJQ-KX3K9-tsnS-_4WJkSDeWtfDsnm5bt3rQeV5O7LL7u4fv334DnwvdN_FFQe5J1vC47C_I0bXpAlOYrcQZqF32988q7nXGEgTzQ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