[PATCH] D157061: [SampleProfile] Potential use after move in SampleProfileLoader::promoteMergeNotInlinedContextSamples
William Junda Huang via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 15 17:41:43 PDT 2023
huangjd added inline comments.
================
Comment at: llvm/lib/Transforms/IPO/SampleProfile.cpp:1626
+ if (!OutlineFS)
+ OutlineFS = &OutlineFunctionSamples[
+ FunctionSamples::getCanonicalFnName(Callee->getName())];
----------------
huangjd wrote:
> wenlei wrote:
> > We could also be inserting into `OutlineFunctionSamples` which can cause rehash while using a FunctionSamples from `OutlineFunctionSamples`?
> >
> > I'm wondering if `OutlineFunctionSamples` should use a container that guarantees reference stability, e.g. `std::map` instead of `std::unordered_map`.
> >
> >
> That's OK, there is no pointer reference OutlineFunctionSamples, so there's no concern of segfault. Performance is trivial because very few inlined functions are actually promoted to outline function (say < 10 in a production project )
The pointer here is used immediately and won't be used outside of the function
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D157061/new/
https://reviews.llvm.org/D157061
More information about the llvm-commits
mailing list