[PATCH] D144314: [MemProf] Add printing utilities for MemProf summary structures

Snehasish Kumar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 21 12:16:34 PST 2023


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

lgtm with some minor comments.



================
Comment at: llvm/unittests/IR/ModuleSummaryIndexTest.cpp:18
+
+class ModuleSummaryIndexTest : public testing::Test {
+protected:
----------------
nit: Unless you have state shared across multiple tests, it would be simpler to avoid the test fixture and keep `makeLLVMIndex` as static helper method.


================
Comment at: llvm/unittests/IR/ModuleSummaryIndexTest.cpp:33
+^0 = module: (path: "test.o", hash: (0, 0, 0, 0, 0))
+^1 = gv: (guid: 23, summaries: (function: (module: ^0, flags: (linkage: external, visibility: default, notEligibleToImport: 0, live: 0, dsoLocal: 1, canAutoHide: 0), insts: 2, funcFlags: (readNone: 0, readOnly: 0, noRecurse: 0, returnDoesNotAlias: 0, noInline: 1, alwaysInline: 0, noUnwind: 0, mayThrow: 0, hasUnknownCall: 0, mustBeUnreachable: 0), allocs: ((versions: (none), memProf: ((type: notcold, stackIds: (1, 2, 3, 4)), (type: cold, stackIds: (1, 2, 3, 5))))))))
+^2 = gv: (guid: 25, summaries: (function: (module: ^0, flags: (linkage: external, visibility: default, notEligibleToImport: 0, live: 0, dsoLocal: 1, canAutoHide: 0), insts: 22, funcFlags: (readNone: 0, readOnly: 0, noRecurse: 1, returnDoesNotAlias: 0, noInline: 1, alwaysInline: 0, noUnwind: 0, mayThrow: 0, hasUnknownCall: 0, mustBeUnreachable: 0), calls: ((callee: ^1)), callsites: ((callee: ^1, clones: (0), stackIds: (3, 4)), (callee: ^1, clones: (0), stackIds: (3, 5))))))
----------------
Can we remove content in the string summary which is unrelated to the test? E.g. funcFlags should be ok to drop?


================
Comment at: llvm/unittests/IR/ModuleSummaryIndexTest.cpp:52
+  OS.flush();
+  EXPECT_EQ(Data, "Callee: 23 Clones: 0 StackIds: 2, 3\n"
+                  "Callee: 23 Clones: 0 StackIds: 2, 4\n"
----------------
Can we use a raw string for the expectation?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D144314



More information about the llvm-commits mailing list