To elaborate:
On Darwin, x18 is used as a scratch register in context switches on hardware where Meltdown mitigations are needed.
As such, it is cleaned on each ctx switch on that hardware.
On M1, it's currently usable by applications, but that is not part of the ABI contract and might change at any time without notice.
On Windows, x18 is the TEB (thread environment block) register. It must as such _not_ be touched by apps either.