[llvm] [MemProf] Support cloning for indirect calls with ThinLTO (PR #110625)

Snehasish Kumar via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 4 10:47:54 PDT 2024


================
@@ -4075,24 +4367,80 @@ bool MemProfContextDisambiguation::applyImport(Module &M) {
                      << ore::NV("Attribute", AllocTypeString));
           }
         } else if (!CallsiteContext.empty()) {
-          // Consult the next callsite node.
-          assert(SI != FS->callsites().end());
-          auto &StackNode = *(SI++);
-
+          if (!CalledFunction) {
----------------
snehasish wrote:

Can you move the logic under this condition to a helper method? I think it will simplify some of the control flow within the loop by converting to early returns.

For shared state --
ICallAnalysis: can be a private member which can be initialized early instead of in applyImport?
ICallAnalysisMap: can also become a private member too?

https://github.com/llvm/llvm-project/pull/110625


More information about the llvm-commits mailing list