IR: Disallow function-local metadata attachments

Metadata attachments to instructions cannot be function-local.

This is part of PR21532.