[llvm] [NFC]Rename collectPGOFuncNameStrings to collectGlobalObjectNameStrings (PR #70287)
Mingming Liu via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 26 12:40:33 PDT 2023
================
@@ -220,17 +220,17 @@ StringRef getPGOFuncNameVarInitializer(GlobalVariable *NameVar);
StringRef getFuncNameWithoutPrefix(StringRef PGOFuncName,
StringRef FileName = "<unknown>");
-/// Given a vector of strings (function PGO names) \c NameStrs, the
-/// method generates a combined string \c Result that is ready to be
-/// serialized. The \c Result string is comprised of three fields:
-/// The first field is the length of the uncompressed strings, and the
-/// the second field is the length of the zlib-compressed string.
-/// Both fields are encoded in ULEB128. If \c doCompress is false, the
+/// Given a vector of strings (names of global objects, like func PGO names,
+/// virtual tables, etc) \c NameStrs, the method generates a combined string \c
+/// Result that is ready to be serialized. The \c Result string is comprised of
+/// three fields: The first field is the length of the uncompressed strings, and
+/// the the second field is the length of the zlib-compressed string. Both
+/// fields are encoded in ULEB128. If \c doCompress is false, the
/// third field is the uncompressed strings; otherwise it is the
/// compressed string. When the string compression is off, the
/// second field will have value zero.
-Error collectPGOFuncNameStrings(ArrayRef<std::string> NameStrs,
- bool doCompression, std::string &Result);
+Error collectGlobalObjectNameStrings(ArrayRef<std::string> NameStrs,
----------------
minglotus-6 wrote:
good question. I'll need to record the PGO name of vtables (i.e., just variable name if the vtable is external, and variable name with file path prefix if the vtable is local) jus like we record PGO name of functions (e.g., [guid computed from global identifier](https://github.com/llvm/llvm-project/blob/92b4e05494126f39716048aa09a2b89485384574/llvm/include/llvm/IR/GlobalValue.h#L589-L591) is used for LTO) so a few other methods (with `Func` in function name, or `Function` as function paremeter type) needs to be generalized.
In this patch, added two small rename for static functions. The other [collectPGOFuncNameStrings](https://github.com/llvm/llvm-project/blob/92b4e05494126f39716048aa09a2b89485384574/llvm/include/llvm/ProfileData/InstrProf.h#L235-238) currently takes the global variable that consisting of a string literal (`@__profn__Z4funcP4BaseP14FuncPtrWrapper = private constant [30 x i8] c"_Z4funcP4BaseP14FuncPtrWrapper"` in the per-pass output of `pgo-instr-gen` in https://gcc.godbolt.org/z/97b6rzvvx) so I'll keep them there.
If more renames are needed later, I'm thinking of keeping the name `getIRPGOFuncName` since it's clearer for callers to know the callee is what they want (which reduces brain teasers to correlate 'Func' with 'Object' at least for me), and let it forward to an internal static function `getIRPGONameForObject`).
https://github.com/llvm/llvm-project/pull/70287
More information about the llvm-commits
mailing list