<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/55249>55249</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
WebAssemblyFixIrreducibleControlFlow breaks register liveness
</td>
</tr>
<tr>
<th>Labels</th>
<td>
backend:WebAssembly
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
arsenm
</td>
</tr>
</table>
<pre>
I accidentally fixed a bug in the machine verifier that was missing various liveness violations. Besides some artificially broken MIR test cases, the only real bug this catches is WebAssembly's irreducible-cfg.ll test (which fails with "Virtual register defs don't dominate all uses.")
In the first function, we end up with a CFG like this:
```
; %bb.0.bb -------------|
; | |
; | v
; bb.1.bb3 def bb.8
; | __________|
; bb.10 /
; | /
; |--> bb.7----- bb.2 ------ bb.6 return
; | | \ |
; | | \ |
; | use bb.5 \ bb.3 def
; | |
; | |
; |---- bb.9 -> loop bb.7
```
After the transform, virtual registers %41 and %42 are defined in %bb.1 and %bb.3, and used in %bb.5. On the path from the entry %bb.0 through %bb.8, there's a missing definition. This probably needs to introduce IMPLICIT_DEFs for any live out registers in the newly introduced routing blocks.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyVVNtu2zAM_RrnhajhKHGdPPghTZshwIoNQ7E9FpJNx1pkKZDkpPn7UcqlWZYOm2HYulCHPBR5hKn35RJ4VckatedK7aGRb1gDB9GvQGrwLULHq1ZqhC1a2Ui0tMg97LiDTjon9Qq23ErTO1Byixqdg600intptEvhAR3BO3CmQ-DWE0Yloy9hzRo1PC-_gUfnoeIOXcLm0avRZGGRqxiKb6WjfV-1hETDHyhmzmEn1D5hBS1Zi3VfSaHwrmpWqVIHyIRNdq2sWmi4VA520re0xr5L63uCtriSzhOlGhsHtdEE5unfSc09RUswPcWU0pGETZPsMclmh-_ykJtGWvLS9LoKbEPsOwTUNfSbgzMO88UnSswaI4dkNLtESe6z4xunAJCMHiD8WC5EmqVCwN3lkxTza9MwKubwx_MfpttrQ_I9JN-jkJezFS1O_o74en5uOg-oWSS3-BjnepOWifboKZwuYg4iEDvmJYzv6R59b_X1uUvcJJ_fzMqV2cnulhlVQvCWH61oGPPzIdw_b5x4TCESVcZsItubNXL4zhofG5GqynLtGmO7UHzbq7p2oZDGQ-BUkWHEqAExBE39XIf-PtTZ2SBwCjhhSnQvTPIUvhxKfsOprBtrujgj3bD7U7nSijX9qj3OJ8dethh7lJ_1IgYgQ8ek8BI6e2ON4NTLoBFrB96QY28NdTTC8vnr5-V8-fL6-LRwQEwpun2UGjC9v6B6lCuNOwI6n6-BQvLBq1CmWrt0UJejejqa8oGXXmF5ISUL-bZ8F5K5CRhqocyOpAr52r3rxUnpBr1VZev9JnY2lS5brKjte5FWhm5kodT29Lsjkj-x8jSlNPRB6RZ5zsbTQVuOa84KXhd1wyaTqsinYlqIcTNuRiwbMjYZKC5QuTLJH0iKBK9IN2vy-JsMsiR_HMiSZYxleTYaFuFsKnKeCVoqhryaNkWejDPsSAzTEFNq7GpgyxgeyayjTUUE3fsmpxtb0a1E14TPe98aW3LrUHeDSKSMLH4B5CvXBg">