Fix unsafe memory access

The following expression

  m[i] = m[j]

where m is a DenseMap and i != j is not safe. m[j] returns a
reference, which would be invalidated when a rehashing occurs.
If rehashing occurs to make room for m[i], m[j] becomes
invalid, and that invalid reference would be used as the RHS
value of the expression.

git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@213969 91177308-0d34-0410-b5e6-96231b3b80d8