[AMDGPU] Finalize atomic loads before inserting waits after them (#239590)
In SIMemoryLegalizer::expandLoad, finalizeLoad and setCFS were called
after the acquire/seq_cst waits had been inserted. Inserting a wait
after
the load moves MI to point at the new wait instruction, so these calls
operated on the wait instead of the load:
- load_monitor instructions with acquire or seq_cst ordering at a scope
that maps to SCOPE_CU (e.g. workgroup) were not raised to SCOPE_SE.
- Acquire and seq_cst atomic loads lost their !amdgpu.cfs cache fill
size.
Call them before inserting the waits instead.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>