[llvm] [lld] [ThinLTO] Add module names to ThinLTO final objects (PR #74160)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 1 16:02:32 PST 2023
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff 27f17837bb1d9d49a045af4520eed7e94ad6b5bd d4a8145a47e1e48a5f37bfcf39e250dabf16d4d5 -- lld/ELF/Config.h lld/ELF/Driver.cpp lld/ELF/LTO.cpp llvm/include/llvm/LTO/LTO.h llvm/include/llvm/ProfileData/InstrProfData.inc llvm/include/llvm/Transforms/Instrumentation.h llvm/include/llvm/Transforms/Instrumentation/InstrProfiling.h llvm/include/llvm/Transforms/Instrumentation/PGOInstrumentation.h llvm/lib/Passes/PassBuilderPipelines.cpp llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/include/llvm/ProfileData/InstrProfData.inc b/llvm/include/llvm/ProfileData/InstrProfData.inc
index 6294505ac3..5a0786b9ba 100644
--- a/llvm/include/llvm/ProfileData/InstrProfData.inc
+++ b/llvm/include/llvm/ProfileData/InstrProfData.inc
@@ -80,13 +80,12 @@ INSTR_PROF_DATA(const IntPtrT, IntPtrTy, CounterPtr, RelativeCounterPtr)
* function name hashes during the conversion from raw to merged profile
* data.
*/
-INSTR_PROF_DATA(const IntPtrT, llvm::Type::getInt8PtrTy(Ctx), FunctionPointer, \
+INSTR_PROF_DATA(const IntPtrT, llvm::Type::getInt8PtrTy(Ctx), FunctionPointer,
FunctionAddr)
-INSTR_PROF_DATA(IntPtrT, llvm::Type::getInt8PtrTy(Ctx), Values, \
- ValuesPtrExpr)
+INSTR_PROF_DATA(IntPtrT, llvm::Type::getInt8PtrTy(Ctx), Values, ValuesPtrExpr)
INSTR_PROF_DATA(const uint32_t, llvm::Type::getInt32Ty(Ctx), NumCounters, \
ConstantInt::get(llvm::Type::getInt32Ty(Ctx), NumCounters))
-INSTR_PROF_DATA(const uint16_t, Int16ArrayTy, NumValueSites[IPVK_Last+1], \
+INSTR_PROF_DATA(const uint16_t, Int16ArrayTy, NumValueSites[IPVK_Last + 1],
ConstantArray::get(Int16ArrayTy, Int16ArrayVals))
#undef INSTR_PROF_DATA
/* INSTR_PROF_DATA end. */
@@ -113,7 +112,7 @@ INSTR_PROF_VALUE_NODE(uint64_t, llvm::Type::getInt64Ty(Ctx), Value, \
ConstantInt::get(llvm::Type::GetInt64Ty(Ctx), 0))
INSTR_PROF_VALUE_NODE(uint64_t, llvm::Type::getInt64Ty(Ctx), Count, \
ConstantInt::get(llvm::Type::GetInt64Ty(Ctx), 0))
-INSTR_PROF_VALUE_NODE(PtrToNodeT, llvm::Type::getInt8PtrTy(Ctx), Next, \
+INSTR_PROF_VALUE_NODE(PtrToNodeT, llvm::Type::getInt8PtrTy(Ctx), Next,
ConstantInt::get(llvm::Type::GetInt8PtrTy(Ctx), 0))
#undef INSTR_PROF_VALUE_NODE
/* INSTR_PROF_VALUE_NODE end. */
@@ -131,7 +130,8 @@ INSTR_PROF_RAW_HEADER(uint64_t, BinaryIdsSize, __llvm_write_binary_ids(NULL))
INSTR_PROF_RAW_HEADER(uint64_t, NumData, NumData)
INSTR_PROF_RAW_HEADER(uint64_t, PaddingBytesBeforeCounters, PaddingBytesBeforeCounters)
INSTR_PROF_RAW_HEADER(uint64_t, NumCounters, NumCounters)
-INSTR_PROF_RAW_HEADER(uint64_t, PaddingBytesAfterCounters, PaddingBytesAfterCounters)
+INSTR_PROF_RAW_HEADER(uint64_t, PaddingBytesAfterCounters,
+ PaddingBytesAfterCounters)
INSTR_PROF_RAW_HEADER(uint64_t, NamesSize, NamesSize)
INSTR_PROF_RAW_HEADER(uint64_t, CountersDelta,
(uintptr_t)CountersBegin - (uintptr_t)DataBegin)
@@ -153,40 +153,51 @@ INSTR_PROF_RAW_HEADER(uint64_t, ValueKindLast, IPVK_Last)
#endif
VALUE_PROF_FUNC_PARAM(uint64_t, TargetValue, Type::getInt64Ty(Ctx)) \
INSTR_PROF_COMMA
-VALUE_PROF_FUNC_PARAM(void *, Data, Type::getInt8PtrTy(Ctx)) INSTR_PROF_COMMA
-VALUE_PROF_FUNC_PARAM(uint32_t, CounterIndex, Type::getInt32Ty(Ctx))
+ VALUE_PROF_FUNC_PARAM(void *, Data,
+ Type::getInt8PtrTy(Ctx))
+ INSTR_PROF_COMMA
+ VALUE_PROF_FUNC_PARAM(uint32_t, CounterIndex,
+ Type::getInt32Ty(Ctx))
#undef VALUE_PROF_FUNC_PARAM
#undef INSTR_PROF_COMMA
-/* VALUE_PROF_FUNC_PARAM end */
+ /* VALUE_PROF_FUNC_PARAM end */
-/* VALUE_PROF_KIND start */
+ /* VALUE_PROF_KIND start */
#ifndef VALUE_PROF_KIND
#define VALUE_PROF_KIND(Enumerator, Value, Descr)
#else
#define INSTR_PROF_DATA_DEFINED
#endif
-/* For indirect function call value profiling, the addresses of the target
- * functions are profiled by the instrumented code. The target addresses are
- * written in the raw profile data and converted to target function name's MD5
- * hash by the profile reader during deserialization. Typically, this happens
- * when the raw profile data is read during profile merging.
- *
- * For this remapping the ProfData is used. ProfData contains both the function
- * name hash and the function address.
- */
-VALUE_PROF_KIND(IPVK_IndirectCallTarget, 0, "indirect call target")
-/* For memory intrinsic functions size profiling. */
-VALUE_PROF_KIND(IPVK_MemOPSize, 1, "memory intrinsic functions size")
-/* These two kinds must be the last to be
- * declared. This is to make sure the string
- * array created with the template can be
- * indexed with the kind value.
- */
-VALUE_PROF_KIND(IPVK_First, IPVK_IndirectCallTarget, "first")
-VALUE_PROF_KIND(IPVK_Last, IPVK_MemOPSize, "last")
+ /* For indirect function call value profiling, the
+ * addresses of the target functions are profiled by
+ * the instrumented code. The target addresses are
+ * written in the raw profile data and converted to
+ * target function name's MD5 hash by the profile
+ * reader during deserialization. Typically, this
+ * happens when the raw profile data is read during
+ * profile merging.
+ *
+ * For this remapping the ProfData is used. ProfData
+ * contains both the function name hash and the
+ * function address.
+ */
+ VALUE_PROF_KIND(IPVK_IndirectCallTarget, 0,
+ "indirect call target")
+ /* For memory intrinsic functions size profiling. */
+ VALUE_PROF_KIND(IPVK_MemOPSize, 1,
+ "memory intrinsic functions size")
+ /* These two kinds must be the last to be
+ * declared. This is to make sure the string
+ * array created with the template can be
+ * indexed with the kind value.
+ */
+ VALUE_PROF_KIND(
+ IPVK_First, IPVK_IndirectCallTarget,
+ "first") VALUE_PROF_KIND(IPVK_Last,
+ IPVK_MemOPSize, "last")
#undef VALUE_PROF_KIND
-/* VALUE_PROF_KIND end */
+ /* VALUE_PROF_KIND end */
#undef COVMAP_V2_OR_V3
#ifdef COVMAP_V2
@@ -196,153 +207,238 @@ VALUE_PROF_KIND(IPVK_Last, IPVK_MemOPSize, "last")
#define COVMAP_V2_OR_V3
#endif
-/* COVMAP_FUNC_RECORD start */
-/* Definition of member fields of the function record structure in coverage
- * map.
- */
+ /* COVMAP_FUNC_RECORD start */
+ /* Definition of member fields of the function record
+ * structure in coverage map.
+ */
#ifndef COVMAP_FUNC_RECORD
-#define COVMAP_FUNC_RECORD(Type, LLVMType, Name, Initializer)
+#define COVMAP_FUNC_RECORD(Type, LLVMType, Name, \
+ Initializer)
#else
#define INSTR_PROF_DATA_DEFINED
#endif
#ifdef COVMAP_V1
-COVMAP_FUNC_RECORD(const IntPtrT, llvm::Type::getInt8PtrTy(Ctx), \
- NamePtr, llvm::ConstantExpr::getBitCast(NamePtr, \
- llvm::Type::getInt8PtrTy(Ctx)))
-COVMAP_FUNC_RECORD(const uint32_t, llvm::Type::getInt32Ty(Ctx), NameSize, \
- llvm::ConstantInt::get(llvm::Type::getInt32Ty(Ctx), \
- NameValue.size()))
+ COVMAP_FUNC_RECORD(
+ const IntPtrT, llvm::Type::getInt8PtrTy(Ctx),
+ NamePtr,
+ llvm::ConstantExpr::getBitCast(
+ NamePtr,
+ llvm::Type::getInt8PtrTy(
+ Ctx))) COVMAP_FUNC_RECORD(const uint32_t,
+ llvm::Type::
+ getInt32Ty(
+ Ctx),
+ NameSize,
+ llvm::ConstantInt::get(
+ llvm::Type::
+ getInt32Ty(
+ Ctx),
+ NameValue
+ .size()))
#endif
#ifdef COVMAP_V2_OR_V3
-COVMAP_FUNC_RECORD(const int64_t, llvm::Type::getInt64Ty(Ctx), NameRef, \
- llvm::ConstantInt::get( \
- llvm::Type::getInt64Ty(Ctx), NameHash))
+ COVMAP_FUNC_RECORD(
+ const int64_t,
+ llvm::Type::getInt64Ty(Ctx), NameRef,
+ llvm::ConstantInt::get(
+ llvm::Type::getInt64Ty(Ctx),
+ NameHash))
#endif
-COVMAP_FUNC_RECORD(const uint32_t, llvm::Type::getInt32Ty(Ctx), DataSize, \
- llvm::ConstantInt::get( \
- llvm::Type::getInt32Ty(Ctx), CoverageMapping.size()))
-COVMAP_FUNC_RECORD(const uint64_t, llvm::Type::getInt64Ty(Ctx), FuncHash, \
- llvm::ConstantInt::get( \
- llvm::Type::getInt64Ty(Ctx), FuncHash))
+ COVMAP_FUNC_RECORD(
+ const uint32_t,
+ llvm::Type::getInt32Ty(Ctx), DataSize,
+ llvm::ConstantInt::get(
+ llvm::Type::getInt32Ty(Ctx),
+ CoverageMapping.size()))
+ COVMAP_FUNC_RECORD(
+ const uint64_t,
+ llvm::Type::getInt64Ty(Ctx),
+ FuncHash,
+ llvm::ConstantInt::get(
+ llvm::Type::getInt64Ty(Ctx),
+ FuncHash))
#ifdef COVMAP_V3
-COVMAP_FUNC_RECORD(const uint64_t, llvm::Type::getInt64Ty(Ctx), FilenamesRef, \
- llvm::ConstantInt::get( \
- llvm::Type::getInt64Ty(Ctx), FilenamesRef))
-COVMAP_FUNC_RECORD(const char, \
- llvm::ArrayType::get(llvm::Type::getInt8Ty(Ctx), \
- CoverageMapping.size()), \
- CoverageMapping,
- llvm::ConstantDataArray::getRaw( \
- CoverageMapping, CoverageMapping.size(), \
- llvm::Type::getInt8Ty(Ctx)))
+ COVMAP_FUNC_RECORD(
+ const uint64_t,
+ llvm::Type::getInt64Ty(Ctx),
+ FilenamesRef,
+ llvm::ConstantInt::get(
+ llvm::Type::getInt64Ty(
+ Ctx),
+ FilenamesRef))
+ COVMAP_FUNC_RECORD(
+ const char,
+ llvm::ArrayType::get(
+ llvm::Type::getInt8Ty(
+ Ctx),
+ CoverageMapping
+ .size()),
+ CoverageMapping,
+ llvm::ConstantDataArray::
+ getRaw(
+ CoverageMapping,
+ CoverageMapping
+ .size(),
+ llvm::Type::
+ getInt8Ty(
+ Ctx)))
#endif
#undef COVMAP_FUNC_RECORD
-/* COVMAP_FUNC_RECORD end. */
+ /* COVMAP_FUNC_RECORD end. */
-/* COVMAP_HEADER start */
-/* Definition of member fields of coverage map header.
- */
+ /* COVMAP_HEADER start */
+ /* Definition of member fields of coverage map header.
+ */
#ifndef COVMAP_HEADER
#define COVMAP_HEADER(Type, LLVMType, Name, Initializer)
#else
#define INSTR_PROF_DATA_DEFINED
#endif
-COVMAP_HEADER(uint32_t, Int32Ty, NRecords, \
- llvm::ConstantInt::get(Int32Ty, NRecords))
-COVMAP_HEADER(uint32_t, Int32Ty, FilenamesSize, \
- llvm::ConstantInt::get(Int32Ty, FilenamesSize))
-COVMAP_HEADER(uint32_t, Int32Ty, CoverageSize, \
- llvm::ConstantInt::get(Int32Ty, CoverageMappingSize))
-COVMAP_HEADER(uint32_t, Int32Ty, Version, \
- llvm::ConstantInt::get(Int32Ty, CovMapVersion::CurrentVersion))
+ COVMAP_HEADER(
+ uint32_t, Int32Ty,
+ NRecords,
+ llvm::ConstantInt::get(
+ Int32Ty,
+ NRecords)) COVMAP_HEADER(uint32_t,
+ Int32Ty,
+ FilenamesSize,
+ llvm::ConstantInt::
+ get(Int32Ty,
+ FilenamesSize))
+ COVMAP_HEADER(
+ uint32_t, Int32Ty,
+ CoverageSize,
+ llvm::ConstantInt::get(
+ Int32Ty,
+ CoverageMappingSize))
+ COVMAP_HEADER(
+ uint32_t,
+ Int32Ty,
+ Version,
+ llvm::ConstantInt::get(
+ Int32Ty,
+ CovMapVersion::
+ CurrentVersion))
#undef COVMAP_HEADER
-/* COVMAP_HEADER end. */
-
+ /* COVMAP_HEADER end. */
#ifdef INSTR_PROF_SECT_ENTRY
#define INSTR_PROF_DATA_DEFINED
-INSTR_PROF_SECT_ENTRY(IPSK_data, \
- INSTR_PROF_QUOTE(INSTR_PROF_DATA_COMMON), \
- INSTR_PROF_DATA_COFF, "__DATA,")
-INSTR_PROF_SECT_ENTRY(IPSK_cnts, \
- INSTR_PROF_QUOTE(INSTR_PROF_CNTS_COMMON), \
- INSTR_PROF_CNTS_COFF, "__DATA,")
-INSTR_PROF_SECT_ENTRY(IPSK_name, \
- INSTR_PROF_QUOTE(INSTR_PROF_NAME_COMMON), \
- INSTR_PROF_NAME_COFF, "__DATA,")
-INSTR_PROF_SECT_ENTRY(IPSK_vals, \
- INSTR_PROF_QUOTE(INSTR_PROF_VALS_COMMON), \
- INSTR_PROF_VALS_COFF, "__DATA,")
-INSTR_PROF_SECT_ENTRY(IPSK_vnodes, \
- INSTR_PROF_QUOTE(INSTR_PROF_VNODES_COMMON), \
- INSTR_PROF_VNODES_COFF, "__DATA,")
-INSTR_PROF_SECT_ENTRY(IPSK_covmap, \
- INSTR_PROF_QUOTE(INSTR_PROF_COVMAP_COMMON), \
- INSTR_PROF_COVMAP_COFF, "__LLVM_COV,")
-INSTR_PROF_SECT_ENTRY(IPSK_covfun, \
- INSTR_PROF_QUOTE(INSTR_PROF_COVFUN_COMMON), \
- INSTR_PROF_COVFUN_COFF, "__LLVM_COV,")
-INSTR_PROF_SECT_ENTRY(IPSK_orderfile, \
- INSTR_PROF_QUOTE(INSTR_PROF_ORDERFILE_COMMON), \
- INSTR_PROF_QUOTE(INSTR_PROF_ORDERFILE_COFF), "__DATA,")
+ INSTR_PROF_SECT_ENTRY(
+ IPSK_data,
+ INSTR_PROF_QUOTE(
+ INSTR_PROF_DATA_COMMON),
+ INSTR_PROF_DATA_COFF,
+ "__DATA,")
+ INSTR_PROF_SECT_ENTRY(
+ IPSK_cnts,
+ INSTR_PROF_QUOTE(
+ INSTR_PROF_CNTS_COMMON),
+ INSTR_PROF_CNTS_COFF,
+ "__"
+ "DATA"
+ ",") INSTR_PROF_SECT_ENTRY(IPSK_name,
+ INSTR_PROF_QUOTE(
+ INSTR_PROF_NAME_COMMON),
+ INSTR_PROF_NAME_COFF,
+ "__DATA,")
+ INSTR_PROF_SECT_ENTRY(
+ IPSK_vals,
+ INSTR_PROF_QUOTE(
+ INSTR_PROF_VALS_COMMON),
+ INSTR_PROF_VALS_COFF,
+ "__DATA,")
+ INSTR_PROF_SECT_ENTRY(
+ IPSK_vnodes,
+ INSTR_PROF_QUOTE(
+ INSTR_PROF_VNODES_COMMON),
+ INSTR_PROF_VNODES_COFF,
+ "__DATA,")
+ INSTR_PROF_SECT_ENTRY(
+ IPSK_covmap,
+ INSTR_PROF_QUOTE(
+ INSTR_PROF_COVMAP_COMMON),
+ INSTR_PROF_COVMAP_COFF,
+ "__LLVM_COV,")
+ INSTR_PROF_SECT_ENTRY(
+ IPSK_covfun,
+ INSTR_PROF_QUOTE(
+ INSTR_PROF_COVFUN_COMMON),
+ INSTR_PROF_COVFUN_COFF,
+ "__LLVM_COV,")
+ INSTR_PROF_SECT_ENTRY(
+ IPSK_orderfile,
+ INSTR_PROF_QUOTE(
+ INSTR_PROF_ORDERFILE_COMMON),
+ INSTR_PROF_QUOTE(
+ INSTR_PROF_ORDERFILE_COFF),
+ "__DATA,")
#undef INSTR_PROF_SECT_ENTRY
#endif
-
#ifdef INSTR_PROF_VALUE_PROF_DATA
#define INSTR_PROF_DATA_DEFINED
#define INSTR_PROF_MAX_NUM_VAL_PER_SITE 255
-/*!
- * This is the header of the data structure that defines the on-disk
- * layout of the value profile data of a particular kind for one function.
- */
-typedef struct ValueProfRecord {
- /* The kind of the value profile record. */
- uint32_t Kind;
- /*
- * The number of value profile sites. It is guaranteed to be non-zero;
- * otherwise the record for this kind won't be emitted.
- */
- uint32_t NumValueSites;
- /*
- * The first element of the array that stores the number of profiled
- * values for each value site. The size of the array is NumValueSites.
- * Since NumValueSites is greater than zero, there is at least one
- * element in the array.
- */
- uint8_t SiteCountArray[1];
-
- /*
- * The fake declaration is for documentation purpose only.
- * Align the start of next field to be on 8 byte boundaries.
- uint8_t Padding[X];
- */
-
- /* The array of value profile data. The size of the array is the sum
- * of all elements in SiteCountArray[].
- InstrProfValueData ValueData[];
- */
+ /*!
+ * This is the header of the data structure that
+ * defines the on-disk layout of the value profile
+ * data of a particular kind for one function.
+ */
+ typedef struct ValueProfRecord {
+ /* The kind of the value profile record. */
+ uint32_t Kind;
+ /*
+ * The number of value profile sites. It is guaranteed
+ * to be non-zero; otherwise the record for this kind
+ * won't be emitted.
+ */
+ uint32_t NumValueSites;
+ /*
+ * The first element of the array that stores the number
+ * of profiled values for each value site. The size of
+ * the array is NumValueSites. Since NumValueSites is
+ * greater than zero, there is at least one element in
+ * the array.
+ */
+ uint8_t SiteCountArray[1];
+
+ /*
+ * The fake declaration is for documentation purpose
+ only.
+ * Align the start of next field to be on 8 byte
+ boundaries. uint8_t Padding[X];
+ */
+
+ /* The array of value profile data. The size of the
+ array is the sum
+ * of all elements in SiteCountArray[].
+ InstrProfValueData ValueData[];
+ */
#ifdef __cplusplus
- /*!
- * Return the number of value sites.
- */
- uint32_t getNumValueSites() const { return NumValueSites; }
- /*!
- * Read data from this record and save it to Record.
- */
- void deserializeTo(InstrProfRecord &Record,
- InstrProfSymtab *SymTab);
- /*
- * In-place byte swap:
- * Do byte swap for this instance. \c Old is the original order before
- * the swap, and \c New is the New byte order.
- */
- void swapBytes(llvm::endianness Old, llvm::endianness New);
+ /*!
+ * Return the number of value sites.
+ */
+ uint32_t getNumValueSites() const {
+ return NumValueSites;
+ }
+ /*!
+ * Read data from this record and save it to Record.
+ */
+ void deserializeTo(InstrProfRecord &Record,
+ InstrProfSymtab *SymTab);
+ /*
+ * In-place byte swap:
+ * Do byte swap for this instance. \c Old is the
+ * original order before the swap, and \c New is the New
+ * byte order.
+ */
+ void swapBytes(llvm::endianness Old,
+ llvm::endianness New);
#endif
-} ValueProfRecord;
+ } ValueProfRecord;
/*!
* Per-function header/control data structure for value profiling
@@ -461,7 +557,6 @@ getValueProfRecordHeaderSize(uint32_t NumValueSites);
#undef INSTR_PROF_VALUE_PROF_DATA
#endif /* INSTR_PROF_VALUE_PROF_DATA */
-
#ifdef INSTR_PROF_COMMON_API_IMPL
#define INSTR_PROF_DATA_DEFINED
#ifdef __cplusplus
``````````
</details>
https://github.com/llvm/llvm-project/pull/74160
More information about the llvm-commits
mailing list