This patch fixes some incorrect behaviour in Constants.cpp, in which as part of destroying a constant we replace any references to that constant from metadata with an undef value of the same type. This is incorrect for any non-debug-info metadata, and debug info metadata already has RAUW handlers to insert an undef value if the constant is destroyed (and replaced with nullptr).
This resolves the issue introduced in rGe5d958c45629 and mentioned in D108642.