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

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 19 15:48:40 PDT 2019


efriedma accepted this revision.
efriedma added a comment.
This revision is now accepted and ready to land.

LGTM



================
Comment at: lib/Linker/IRMover.cpp:1067
+    Old->replaceAllUsesWith(New);
+    Old->eraseFromParent();
+  }
----------------
rafauler wrote:
> 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
You're right, sorry, I misread the code.


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