<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/58451>58451</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Compilation hangs if -DCMAKE_BUILD_TYPE=MinSizeRel and -DCMAKE_CXX_FLAGS="-flto" is given
</td>
</tr>
<tr>
<th>Labels</th>
<td>
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
Volker-Weissmann
</td>
</tr>
</table>
<pre>
If I build llvm like this:
```
RELEASE="llvm-project-15.0.2.src"
version=${RELEASE##llvm-project-}; version=${version%.src}
curl -LO https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/$RELEASE.tar.xz
tar -xf $RELEASE.tar.xz
cmake -S $RELEASE/llvm -B $RELEASE/build -DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra" -DCMAKE_CXX_FLAGS="-flto" -DCMAKE_BUILD_TYPE=MinSizeRel
cmake --build $RELEASE/build -j$(nproc) --target clang-format
```
it eventually hangs:
```
...
[ 33%] Building AttrImpl.inc...
[ 33%] Building AttrTextNodeDump.inc...
[ 33%] Built target llvm-tblgen
[ 33%] Building AttrNodeTraverse.inc...
*no more output, even if I wait a lot*
```
`ps` shows the hanging process:
```
$ ps -ef | grep tblgen
volker 38662 38660 99 19:21 pts/0 00:26:58 ../../../../../bin/clang-tblgen -gen-clang-attr-classes -I /home/volker/Documents/formatbug/llvm-project-15.0.2.src/clang/include/clang/AST -I/home/volker/Documents/formatbug/llvm-project-15.0.2.src/clang/include -I/home/volker/Documents/formatbug/llvm-project-15.0.2.src/build/tools/clang/include -I/home/volker/Documents/formatbug/llvm-project-15.0.2.src/build/include -I/home/volker/Documents/formatbug/llvm-project-15.0.2.src/llvm/include /home/volker/Documents/formatbug/llvm-project-15.0.2.src/clang/include/clang/AST/../Basic/Attr.td --write-if-changed -o /home/volker/Documents/formatbug/llvm-project-15.0.2.src/build/tools/clang/include/clang/AST/Attrs.inc
volker 39163 39161 99 19:22 pts/0 00:26:18 ../../../../../bin/clang-tblgen -gen-clang-attr-impl -I /home/volker/Documents/formatbug/llvm-project-15.0.2.src/clang/include/clang/AST -I/home/volker/Documents/formatbug/llvm-project-15.0.2.src/clang/include -I/home/volker/Documents/formatbug/llvm-project-15.0.2.src/build/tools/clang/include -I/home/volker/Documents/formatbug/llvm-project-15.0.2.src/build/include -I/home/volker/Documents/formatbug/llvm-project-15.0.2.src/llvm/include /home/volker/Documents/formatbug/llvm-project-15.0.2.src/clang/include/clang/AST/../Basic/Attr.td --write-if-changed -o /home/volker/Documents/formatbug/llvm-project-15.0.2.src/build/tools/clang/include/clang/AST/AttrImpl.inc
volker 39175 39173 99 19:22 pts/0 00:26:18 ../../../../../bin/clang-tblgen -gen-clang-attr-text-node-dump -I /home/volker/Documents/formatbug/llvm-project-15.0.2.src/clang/include/clang/AST -I/home/volker/Documents/formatbug/llvm-project-15.0.2.src/clang/include -I/home/volker/Documents/formatbug/llvm-project-15.0.2.src/build/tools/clang/include -I/home/volker/Documents/formatbug/llvm-project-15.0.2.src/build/include -I/home/volker/Documents/formatbug/llvm-project-15.0.2.src/llvm/include /home/volker/Documents/formatbug/llvm-project-15.0.2.src/clang/include/clang/AST/../Basic/Attr.td --write-if-changed -o /home/volker/Documents/formatbug/llvm-project-15.0.2.src/build/tools/clang/include/clang/AST/AttrTextNodeDump.inc
volker 39184 39182 99 19:22 pts/0 00:26:13 ../../../../../bin/clang-tblgen -gen-clang-attr-node-traverse -I /home/volker/Documents/formatbug/llvm-project-15.0.2.src/clang/include/clang/AST -I/home/volker/Documents/formatbug/llvm-project-15.0.2.src/clang/include -I/home/volker/Documents/formatbug/llvm-project-15.0.2.src/build/tools/clang/include -I/home/volker/Documents/formatbug/llvm-project-15.0.2.src/build/include -I/home/volker/Documents/formatbug/llvm-project-15.0.2.src/llvm/include /home/volker/Documents/formatbug/llvm-project-15.0.2.src/clang/include/clang/AST/../Basic/Attr.td --write-if-changed -o /home/volker/Documents/formatbug/llvm-project-15.0.2.src/build/tools/clang/include/clang/AST/AttrNodeTraverse.inc
```
I once let it run overnight, it did not finish in that time.
If I either remove the "-flto" flag or replace "MinSizeRel" with "Debug" it builds just fine.
I observed the same bug on the master branch.
I'm currently trying to find and fix this bug myself, If I give up I will update this post. This will be my first contribution to llvm.
OS: ArchLinux
Arch: x86
Compiler: gcc 12.2.0
Also, thank you for making clang-format open source.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJztWEtT4zgQ_jXOpcsuP2InOeSQF1vZDcMUsLOzJ0q2FUcgSylJhmR-_bRkZycwYdmtgQsFZSyppX6o1Z_i7lyW-_FyDUvIG8ZL4Py-Bs7uKJgN014y8cK5F068LOweN7xcrBaTq4WXzL04tiz-VslbWhg_SoMwiAOtCpxpF99TpZkUbnHfG0wPzHGCzyNmbzD3kik8ZTiM49TJxUVObtEoDv7qAjbGbJ2p8Rk-FTObJg8KWePAiu-agxYcKsop0VRjt5QPgktSdoukqvzHSlGbFdvvrA4MUcHuW2sB9sHfreGZ6aIm6Ef_6mi-UwP-9DGxdb4_X62-nN8sPk2mq8XN58uL3xez66vWywUnokLvuNY3UnLt051RBOeQcXY--WNxM_v69eZsNfmt4_HX3Mjj-emfy9X85vrvz_bozpm4Yt_oJeWPzPVbW06Zd2tdEw8FehKPd4RrcbsVNdAatZaqJuZkwDAD9J4K0xDO97DB1c_GVhAEHT2dQoIxknrpHKbWAiYqmBijlvWWB0wU_2HpNfrokyzpvKm3_85ioNuMCxaT84qKl6RbydeK2Fihj6XHEyEBw4mCbMy2waibOQ8As1h7IOgQAlwi_bQXsIMxnYWgN_JBIxip85pVbL1P9bP-s2c0i70J8oNPMTgHM6gU3cLxlu4lv6MK7F8yzLK4a0MYjSAaoeg4gq2xAAntmjC0pAxf6RBwj_HZqVfOEKNnXYA6ZeDjy28pBP1luxqBB_4SA-xsI2uKTWsMduayaGqMEqu3Daa8qZ7A99EN0yrDFn3Pm5IeUSZX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