<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/126827>126827</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Extend clang/utils/creduce-clang-crash.py to reduce middle-end and backend crashes using llvm-reduce
</td>
</tr>
<tr>
<th>Labels</th>
<td>
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
aeubanks
</td>
</tr>
</table>
<pre>
[creduce-clang-crash.py](https://github.com/llvm/llvm-project/blob/main/clang/utils/creduce-clang-crash.py) takes a clang command that crashes, creates an interestingness test from it, and passes it off to creduce/cvise. Reducing at the source language level can be quite slow and doesn't produce a nice `opt`/`llc` command with reduced IR for middle-end and backend crashes.
Before deciding to run creduce/cvise, we should try running `opt -On`/`llc -On` on the output IR.
For middle-end crashes, if we see `clang -On -Xclang -disable-llvm-passes -S -emit-llvm -o /tmp/a.ll; opt -On /tmp/a.ll -disable-output` still reproduces the crash, we should reduce `/tmp/a.ll` with `llvm-reduce` using `opt -On /tmp/a.ll` as the interestingness test.
For backend crashes, if we see `clang -On -Xclang -S -emit-llvm -o /tmp/a.ll; llc -On /tmp/a.ll -o /dev/null` still reproduces the crash, we should reduce `/tmp/a.ll` with `llvm-reduce` using `llc -On /tmp/a.ll` as the interestingness test.
(we should also rename the script to `reduce-clang-crash.py`)
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJy8lEFz6yYQxz8NvuzII6FIlg46JH3VzDu9mfTSK4K1RYNAhcVpvn0HpDROmmnTS08WZtn97f8PK0LQF4s4sOaBNd8OItLs_CAwTsI-hcPk1Evakx5VlFhII-ylkF6E-bi-sOYb491MtAZW3zM-Mj5eNM1xOkq3MD4ac339KVbvfkNJjI-TcRPj4yK0ZXzMKRkfI2kT0vrzUrwHEk8YQEDeAemWRVgFNAuCHIaB8Z9AehSU4ixoS-gxkLYXiyEAYSA4e7eAphSajq8iBAygCdz5DORgr59IrjrgER7TWtsLCAKaEYKLXiIkiCguCAavaEAKCxPC71ETQjDuOWdXDoNl_ESwepfSggCrJQJrS7cSa8ukWlsaI1lb_tXTs6YZNg4F3x_h7DwsWimDBVqVM09CPqXvvfMjK-9Zef-AZ-cRFEqtEjI58NF-7Cn1_owQZheNAvIvKcim-A0Lih_2Fm1fg7NZABdpjQTfH_ei43u6Gy_0OdfB3O9mW_HDQvHr_q10EJPBYrsgmxPFL1Dgoin_CYUDxkdaVsZHcTSG1Q-wE77feEu24SXeQNoY8LhrHzJ9xnuvwKYObC3f1GrLzYmswnUpdhXbEmJ4rxb87aDYqn12BW9k--DiVzT7V3l2wz7KkyMVXhkfbdwY_wd9PoX5mj6Md28IwgQHHq1YcHuE0uuV0v1mbfn5xEi0_UENterrXhxwqE51X1ddy5vDPExn2XZV1_ecN1xNXVcp2aizquuqqqpGHvTAS96UvOJlWdZ3zXHqTigq2Z5Uz9upb9hdiYvQ5ph6Pzp_OegQIg4Vbzt-OhgxoQmvg9UPWaEpXgK7K40OFN7OkSaDw89_UL4KX5qH-WVvtvzzYNituPHnEL0Z_vPQzr0lnr2968D_DAAA__-_kREx">