[PATCH] D149117: [MemProf] Context disambiguation cloning pass [patch 4/4]

Snehasish Kumar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 26 16:38:27 PDT 2023


snehasish accepted this revision.
snehasish added a comment.
This revision is now accepted and ready to land.

lgtm



================
Comment at: llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp:3091
+            ORE.emit(OptimizationRemark(DEBUG_TYPE, "MemprofCall", CBClone)
+                     << NV("Call", CBClone) << " in clone "
+                     << NV("Caller", CBClone->getFunction())
----------------
ore::NV instead to make it clear? (similar comment in D141077)


================
Comment at: llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp:3154
+    Changed = applyImport(M);
+    return Changed;
+  }
----------------
nit: The Changed temporary var can be dropped here and below too.
```
if (ImportSummary) 
  return applyImport(M);
```


================
Comment at: llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp:3171
+  if (!ImportSummary && !MemProfImportSummary.empty()) {
+    ExitOnError ExitOnErr("-memprof-import-summary: " + MemProfImportSummary +
+                          ": ");
----------------
The documentation discourages use of ExitOrError in libraries. Though I did see some uses in places which are not tools. You could add a static create method to raise the error outside the constructor but I'm not sure whats the convention of raising a fatal error from the Module pass.

[1] https://github.com/llvm/llvm-project/blob/main/llvm/include/llvm/Support/Error.h#L1353


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D149117



More information about the llvm-commits mailing list