<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/107195>107195</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[EHStreamer] nounwind on call-sites and builtins is ignored
</td>
</tr>
<tr>
<th>Labels</th>
<td>
llvm:codegen
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
nikic
</td>
</tr>
</table>
<pre>
https://llvm.godbolt.org/z/4hhf36Wf8
```llvm
declare void @personality()
declare void @nounwind_decl() nounwind
declare void @nounwind_call()
define void @test_nounwind_decl() personality ptr @personality {
call void @nounwind_decl()
ret void
}
define void @test_nounwind_call() personality ptr @personality {
call void @nounwind_call() nounwind
ret void
}
define void @test_memset(ptr %p) personality ptr @personality {
call void @llvm.memset(ptr %p, i8 0, i64 1000, i1 false)
ret void
}
```
In this example, the gcc_except_table section for `test_nounwind_decl` does not contain information about the call (as the declaration is nounwind), but the sections for `test_nounwind_call` and `test_memset` *do* contain it.
This is because https://github.com/llvm/llvm-project/blob/de37da8e37c4c9042563e186068adca98bf59e07/llvm/lib/CodeGen/AsmPrinter/EHStreamer.cpp#L157 looks at the attributes of a Function operand of the call. This does not work if the call-site was marked `nounwind`, or if it's a libcall lowering, e.g. of an intrinsic.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJykVc2O4zYTfBrq0liBov4POnh3Pn0JkEOABMhxwJ-WzAxFCiQ1s5unD0R5bG9gJJssYEC2WN2srirSPAQ9W8SB1B9J_ZTxLZ6dH6x-0TITTn0ZzjGugZQnwkbCRmNel3x2SjgTc-dnwsY_CBur83kqm9-mjtAnQk-kocdnhx-vFErDPcKr0wpIRVf0wVludPxCWEdYf6l8CLZus2_aqud94YDD-7t_qJDcmEcbTNre0BFDfH60yR1LWKP_C3Eg7cejH8C-z9_xfcd5jAl2YdM-fTOt2yTfTeuu1dcy_gd-Cy4BI2FdIsLq9TsIpnQ9aPgJdAc0PZsKCkqP7wVM3AT8BnXf83g_zI8W4lkHwM98WQ3uHeMZYZbyGT9LXONz5MIgBJRROwuT80CaR1lpKCiHAayLIJ2NXFvQdnJ-4amSC7fF1DxNS1jHQ_p5pPYA6XDzgvU7G3EpuhAIjxkkLxsK3Krr4kXChgJhJ-UIO914xfxehF93BXQAgZJvAeHr0z7reN5ELt1yOfqXx4fVu99RRsJGYZwgbFRYtop3WLaykj2tWN2UWHQNbTquJO87MdU90vauj97rPjmF_0dL2HgKy89e24iesPF_P_wSPfIFfS7XlbDyp6JuwTj3EoAfqvAYvRZbxABuAg7jZg-f3Ip-F8NNV8lzSHNeTXpz_gX0bf1D0BHhjQdYuH_BJOTVjCaFzfm9QEfC2gAcjBbJS-Pe0Gs77xDM5zxx2d2PXtugZZ6poVR92fMMh6JldVW2JWuz81BPdUWF7Pqei7rlspAtEy1t-qnoVSmnTA-Msor2tKId7ao2nwrOS9lMsp26WvUVqSguXJs8HRvn50yHsOFQ0Lbo68xwgSaki52xJHp5kk7hvMvN9sveD8lMsc1hP3w6xHDrFXU06W_h5gWpn64ZBWdv0oWUPrFpE7VNedKzdR5Vtnkz_OtMpTECYeNlkteB_RkAAP__SKkiZQ">