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

Teresa Johnson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 4 09:29:38 PDT 2023


tejohnson marked 3 inline comments as done.
tejohnson added inline comments.


================
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())
----------------
snehasish wrote:
> ore::NV instead to make it clear? (similar comment in D141077)
Done here and elsewhere with the NV calls added in this patch.


================
Comment at: llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp:3171
+  if (!ImportSummary && !MemProfImportSummary.empty()) {
+    ExitOnError ExitOnErr("-memprof-import-summary: " + MemProfImportSummary +
+                          ": ");
----------------
snehasish wrote:
> 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
Good catch. I had copied this approach from the WPD code which I guess is using the wrong mechanism, but I switched to using the mechanism used by FunctionImport.cpp which instead utilizes logAllUnhandledErrors. Also modified the control flow in this file to use early returns which I think makes it simpler to follow.


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