[PATCH] D59552: [Linker] Fix crash handling appending linkage

Rafael Auler via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 19 15:34:21 PDT 2019


rafauler marked an inline comment as done.
rafauler added inline comments.


================
Comment at: lib/Linker/IRMover.cpp:1067
+    Old->replaceAllUsesWith(New);
+    Old->eraseFromParent();
+  }
----------------
efriedma wrote:
> rafauler wrote:
> > efriedma wrote:
> > > ValueMap and AliasValueMap use raw pointers for keys.  Do we need to update them if one of those pointers is deleted?
> > This is handled in Value's destructor
> I don't follow; how could ~Value() possibly find the key of a ValueMap?  (The values are ValueHandles, but that's separate.)
Isn't it the opposite: the values are arbitrary, and the keys are ValueHandles?  From ValueMap.h:179:

    auto MapResult = Map.insert(std::make_pair(Wrap(KV.first), KV.second));

Wrap() installs the callback paraphernalia that updates the map on deletions/ RAUWs at ValueMapCallbackVH::allUsesReplacedWith  / deleted


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D59552/new/

https://reviews.llvm.org/D59552





More information about the llvm-commits mailing list