https://github.com/fhahn approved this pull request. LGTM, thanks! It might be good to add a dedicated test for clearing the flags, rather than relying on AMDGPU/ARM LSR tests. https://github.com/llvm/llvm-project/pull/109293