Copy metadata when value is RAUW'd. It is debatable whether this is the right approac...
[oota-llvm.git] / lib / VMCore / Value.cpp
index 03b0e6f172e3561c505e746566ff20eab5f142b4..ba72af635cdcb5fa8154431ac25619fecab70afd 100644 (file)
@@ -309,6 +309,10 @@ void Value::uncheckedReplaceAllUsesWith(Value *New) {
   // Notify all ValueHandles (if present) that this value is going away.
   if (HasValueHandle)
     ValueHandleBase::ValueIsRAUWd(this, New);
+  if (HasMetadata) {
+    LLVMContext &Context = getContext();
+    Context.pImpl->TheMetadata.ValueIsRAUWd(this, New);
+  }
 
   while (!use_empty()) {
     Use &U = *UseList;