[PATCH] D141077: [MemProf] Context disambiguation cloning pass [patch 3/3]

Teresa Johnson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 24 18:39:46 PDT 2023


tejohnson marked 11 inline comments as done.
tejohnson added a comment.

Went ahead and addressed the rest of the comments.



================
Comment at: llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp:2788
+    unsigned NumClonesCreated = 0;
+    auto CloneFuncIfNeeded = [&](unsigned NumClones) {
+      // We should at least have version 0 which is the original copy.
----------------
snehasish wrote:
> Can we move this functor to a static (or private) helper method? 
> 
> I think we can return the ValueToValueMap vector as a return value and the number of clones created is implicit from the size of the vector.
I moved the large chunk of this that does the actual cloning into a static helper that returns the VMaps array. But I kept the outer functor since it does some checking to see if we even need to do any cloning (since we call it multiple times per function, called from a couple different places) - this avoids the needs for duplicating the initial checking at each site.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141077



More information about the llvm-commits mailing list