When allocating of 16-bit register pairs fails the register allocator falls back to allocating two 8-bit registers indiidually. Often there's just one free 8-bit register, which is then allocated to the lower byte of the 16-bit thing looking for a place to live. For the other 8-bit register we then have to spill something. This can result in a 16-bit register pair being used, but with the upper and lower bytes swapped.
This breaks many optimizations, since instructions that operate on 16-bit register pairs can't be used.
The register allocator should detect this and swap the bytes.