Currently there is no restrictions on where it is possible to add !noundef metadata and as there also is the noundef return attribute this result in booth attribute and metadata possibly is set on call/invoke and need to be handled.
Solution
Like for e.g. nonnull let the verifier reject !noundef metadata unless it is on a load instruction.
call/invoke instructions will then need to use the noundef return attribute instead of the metadata.
Restricting !noundef metadata to loads in the verifier makes sense to me. We already only document !noundef support for loads in LangRef, and our core isGuaranteedNotToBeUndefOrPoison() analysis only handles it on loads. So the metadata is already load-only, both de jure and de facto – we just fail to verify it.
As for atomicrmw, I do agree that all the load value metadata could in principle also be applied to atomicrmw, but that seems like a largely unrelated extension, that should be done for all the load metadata at the same time.