<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/98323>98323</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Miscompile with multivalue ABI
</td>
</tr>
<tr>
<th>Labels</th>
<td>
backend:WebAssembly,
miscompilation
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
nikic
</td>
</tr>
</table>
<pre>
From https://github.com/rust-lang/rust/issues/127318:
```llvm
; RUN: llc -mtriple=wasm32-unknown-unknown -target-abi=experimental-mv
define i64 @test() {
entry:
%pair = call { i64, i64 } @foo()
%v0 = extractvalue { i64, i64 } %pair, 0
%1 = icmp eq i64 %v0, 0
%v1 = extractvalue { i64, i64 } %pair, 1
%_0.sroa.0.0 = select i1 %1, i64 42, i64 %v1
ret i64 %_0.sroa.0.0
}
declare { i64, i64 } @foo()
```
Results in:
```
i64.const 42
local.get 0
call foo
local.set 0
i64.eqz
i64.select
```
Note the get-before-set of local 0.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUVE1vozwQ_jXmYoGMTfg4cEheFOk9bA-VVntcGTMh3hpM7SFt99evDE1Ku1WllaIYRs8XnrGl97ofAWqyO5BdE8kZz9bVo37QKmpt91IfnR3oGXHyROwJPxJ-7DWe5zZRdiD86GaPsZFj__pM-FF7P4Mn_JjyQqRl4LGGsOt_ztafMZfhtSQO9P77HRF7aoyi8YBOTwaIaJ6kHwSP5_FhtE_jdaUxStcDxrLVRDTwPIHTA4woTTxcVs0OTnoEqvOMkowhhGQl4RUlxWFFwIju5RaOUsJ3k9SOEtFQJY0JyMAn_L9VpmiC1MnaVWnDu7CFBc_opMKLNDN8yl4dQolt2OlC1mqYKDyu4CD5EXZJ_9Uk3bB_ssQ7KxOWrFk9GFBIdbokuApk_CYVDK98B3gtbnRem1c02_Z2oIx0nyf7a_Nus7BVuAc_G_RUj2-T8xFX6TxLlB09ElZl_FY2VkmT9BDKb-DQTcKqYP4e6D8Agyo8_n73vm7UF3nvLALFM9AwkS2crIPYA1J7oosLZckKjLpadJWoZAR1WnCWc8bTIjrXeV6WXACUSu2EKiS0hWpVlxZ5KYVUItI1ZzxjRcrSjAmRJyeRdidW5lXGhQSWkozBILVJwqFKrOuj5RDWVSm4iIxswfjljHPeSvUAY0fE_ge0e-9haM0L4aHxhPNBe2WHSRuJ2o6hvGsiVwfZuJ17TzJmtEf_ZoQaDdTfrjygTxrPdJgN6nVG94f_o9mZ-otLZLkK1iWenP0VNnxzj6xfcan5nwAAAP__4gRSFg">