[PATCH] D118774: [DebugInfo][InstrRef][NFC] Use unique_ptr instead of raw pointers for value tables

Jeremy Morse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 23 09:19:24 PST 2022


jmorse marked 2 inline comments as done.
jmorse added inline comments.


================
Comment at: llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp:3165
     // locations.
     emitLocations(MF, SavedLiveIns, MOutLocs, MInLocs, AllVarsNumbering, *TPC);
 
----------------
Orlando wrote:
> Orlando wrote:
> > If I'm reading this correctly, `emitLocations` is becomes responsible for managing the object lifetimes (it `delete`s things from `MOutLocs`  and `MInLocs`); should you `std::move` `MOutLocs` and `MInLocs` to signify this?
> What did you think of this (for `depthFirstVLocAndEmit` since `emitLocations` no longer exists)?
This is a possibility -- however this will only automatically free the outer dimension, and it'll change deallocation from happening when `ExtendRanges` returns, to when `depthFirstVLocalAndEmit` returns, which isn't substantial period of time.

IMO, YMMV, having the outer dimension of value tables allocated/freed by `ExtendRanges` and always passed by reference to everything else, is cleaner to my mind that passing ownership in so that it can be freed. (I don't think it really matters one way or the other).


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

https://reviews.llvm.org/D118774



More information about the llvm-commits mailing list