Make ExecutionEngine::updateGlobalMapping(GV, NULL) properly remove GV's old
address from the reverse mapping, and add a test that this works now.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78127 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/ExecutionEngine/ExecutionEngine.cpp b/lib/ExecutionEngine/ExecutionEngine.cpp
index 8a999da..e827d36 100644
--- a/lib/ExecutionEngine/ExecutionEngine.cpp
+++ b/lib/ExecutionEngine/ExecutionEngine.cpp
@@ -179,7 +179,7 @@
     }
     
     if (!state.getGlobalAddressReverseMap(locked).empty())
-      state.getGlobalAddressReverseMap(locked).erase(Addr);
+      state.getGlobalAddressReverseMap(locked).erase(OldVal);
     return OldVal;
   }