[PATCH] D33513: [ThinLTO] Fix ThinLTO crash while destroying context

Mehdi AMINI via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 5 16:03:21 PDT 2017


mehdi_amini accepted this revision.
mehdi_amini added inline comments.


================
Comment at: include/llvm/IR/Metadata.h:1275-1283
   /// Replace the use of this with MD.
   void replaceUseWith(Metadata *MD) {
     if (!Use)
       return;
     *Use = MD;
+    if(*Use)
+      MetadataTracking::track(*Use);
----------------
ncharlie wrote:
> dexonsmith wrote:
> > I wonder if it would be more or less clear to use:
> > 
> >     MetadataTracking::untrack(this);
> >     assert(!Use && "Somehow this is still being tracked...");
> > 
> > here, instead of just `Use = nullptr`.
> `Use = nullptr` is more direct and shorter, but they both accomplish the same goal. I can have it call `untrack` instead if you want.
My 2 cents: a call to `untrack` carries better the intent.


https://reviews.llvm.org/D33513





More information about the llvm-commits mailing list