ghc no-tntc miscompiles cmm with acquire load followed by goto
```cmm
#include "Cmm.h"
foo (P_ x) {
W_ ty;
again:
ty = W_[x];
switch [0 .. 2] (ty) {
case 0: { return (W_[x + 4]); }
case 1: { x = %acquire P_[x + 4]; goto again; }
case 2: { STK_CHK_GEN(); goto again; }
}
}
```
configure ghc with `--disable-tables-next-to-code` and build with `--flavour=quick-validate+assertions+debug_info+llvm` (unreg changes calling convention, ncg is broken for no-tntc), then compile the example above with `-O -ddump-to-file -ddump-cmm-raw -dsuppress-timestamps -dsuppress-ticks`, we get:
```cmm
==================== Raw Cmm ====================
[foo() { // [R1]
{ []
}
{offset
cc: P64[Sp - 8] = R1; // CmmStore
Sp = Sp - 8; // CmmAssign
call _blk_c3() args: 0, res: 0, upd: 0; // CmmCall
}
},
_blk_c3() { // []
{ []
}
{offset
c3: _c1::P64 = P64[Sp]; // CmmAssign
_c2::I64 = I64[_c1::P64]; // CmmAssign
if (_c2::I64 < 2) goto u0; else goto u2; // CmmCondBranch
u0: if (_c2::I64 < 1) goto c4; else goto c6; // CmmCondBranch
c4: R1 = I64[_c1::P64 + 4]; // CmmAssign
Sp = Sp + 8; // CmmAssign
call (I64[P64[Sp]])(R1) args: 8, res: 0, upd: 8; // CmmCall
c6: (_c1::P64) = call MO_AtomicRead W64 MemOrderAcquire(_c1::P64 + 4); // CmmUnsafeForeignCall
call _blk_c3() args: 0, res: 0, upd: 0; // CmmCall
u2: Sp = Sp - 8; // CmmAssign
call _blk_c7() args: 0, res: 0, upd: 0; // CmmCall
}
},
_blk_c7() { // []
{ []
}
{offset
c7: Sp = Sp + 8; // CmmAssign
call _blk_c3() args: 0, res: 0, upd: 0; // CmmCall
}
},
section ""relreadonly" . block_c7_info" {
block_c7_info:
const _blk_c7;
const 1;
const 30 :: W32;
const 0 :: W32;
}]
```
see where the problem is? look carefully at `_blk_c3` function (the `again` label) and the `c6` block (the `case 1` branch):
- in the `c3` entry block, it reads `x` from a spilled value on the stack to the `_c1` local
- in the `c6` block, it performs an acquire load, then is supposed to update `x` on the stack
- instead, it only assigns to `_c1`, then immediately tail-calls `_blk_c3` (`goto again`)
- now, the tail call to `_blk_c3` discards values all cmm locals, and it drops the update to `x` that's supposed to write to the stack!!!
this bug affects all no-tntc configurations, especially the wasm backend. this is a minimal reproducer of the wasm test timeouts in !16214 for a seemingly subtle change in rts cmm, and blocks that patch.
issue