julia
08963f68 - codegen: give RMW fields a slot when splitting an allocation (#62752)

Commit
22 days ago
codegen: give RMW fields a slot when splitting an allocation (#62752) Fix the recorded effects for RMW operations in alloc-opt: `AllocOpt`'s escape analysis recorded `cmpxchg` and `atomicrmw` as pure stores of their new-value operand, so the field they touch was left with `hasload == false`. `splitOnStack` skips allocating a stack slot for such a field, and then indexes the empty slot vector while rewriting the atomic, reading whatever happened to be on the stack. With assertions this trips `SmallVector::operator[]`; without them it produces a bogus pointer operand and crashes further down the pass pipeline. `addMemOp` now takes separate `isload` and `isstore` flags, and the atomics set both, which keeps `refstore` set for the write-barrier check in `JuliaLICM` while also marking the field as read. Fixes #52575 Disclaimer: Claude did the debugging here, so I didn't verify the bug, but the change seems right regardless and the test seems okay to show it now works on this example. Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Author
Parents
Loading