[PATCH] D114204: [CSSPGO] Sorting nodes in a cycle of profiled call graph.

Wenlei He via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 29 20:08:50 PST 2021


wenlei added inline comments.


================
Comment at: llvm/lib/Transforms/IPO/ProfiledCallGraph.cpp:138
+  for (auto *Node : InputNodes)
+    (void)NodeInfoMap[Node].Group;
+
----------------
hoy wrote:
> wenlei wrote:
> > hoy wrote:
> > > wenlei wrote:
> > > > nit: make this an explicit insert for readability
> > > This is specifically used to construct a `NodeInfo` object in place. An insert operation will involve a copy construction which invalidate the initial value of the `Group` field which should be `this`. An emplace operation may be able to construct the object in place but I haven't figured out how to pass a none parameter into to.
> > > 
> > I thought `emplace()` without a parameter should just work, no? but yeah, I meant emplace.
> No, neither `NodeInfoMap.emplace(Node);` nor `NodeInfoMap.emplace(Node, {});` works.
I think what you need is `NodeInfoMap.emplace(Node, NodeInfo())`. See https://godbolt.org/z/Wrx61rYcY.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114204



More information about the llvm-commits mailing list