[clang] Bfi precision (PR #66285)

2023-10-26 Thread David Li via cfe-commits
david-xl wrote: Contracting my past self (one of the reviewers of the patch), I think coldness check should be based on a global threshold, which exists when synthetic entry count propagation is enabled (without PGO). https://github.com/llvm/llvm-project/pull/66285

[clang-tools-extra] Bfi precision (PR #66285)

2023-10-26 Thread David Li via cfe-commits
david-xl wrote: Agree that deciding coldness based on local entry frequency (2%) is a bad idea though. https://github.com/llvm/llvm-project/pull/66285 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] Bfi precision (PR #66285)

2023-10-26 Thread David Li via cfe-commits
david-xl wrote: Agree that deciding coldness based on local entry frequency (2%) is a bad idea though. https://github.com/llvm/llvm-project/pull/66285 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang-tools-extra] Bfi precision (PR #66285)

2023-10-26 Thread David Li via cfe-commits
david-xl wrote: The old code of not marking them as cold works also just by accident though. https://github.com/llvm/llvm-project/pull/66285 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] Bfi precision (PR #66285)

2023-10-25 Thread David Li via cfe-commits
david-xl wrote: Yes -- the revert can wait until more data is available. I agree that it should help performance in theory. https://github.com/llvm/llvm-project/pull/66285 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang-tools-extra] Bfi precision (PR #66285)

2023-10-25 Thread David Li via cfe-commits
david-xl wrote: Yes -- the revert can wait until more data is available. I agree that it should help performance in theory. https://github.com/llvm/llvm-project/pull/66285 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [Profile] Refactor profile correlation. (PR #69656)

2023-10-25 Thread David Li via cfe-commits
@@ -24,15 +24,38 @@ using namespace llvm; -/// Get the __llvm_prf_cnts section. -Expected getCountersSection(const object::ObjectFile ) { +namespace llvm { +// Deprecated. Use -profile-correlate=debug-info. +cl::opt DebugInfoCorrelate( +"debug-info-correlate", +

[clang-tools-extra] Bfi precision (PR #66285)

2023-10-25 Thread David Li via cfe-commits
david-xl wrote: This is concerning. Can this be reverted for now and we can help with some internal performance testing. @xur-llvm https://github.com/llvm/llvm-project/pull/66285 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [Profile] Refactor profile correlation. (PR #69656)

2023-10-25 Thread David Li via cfe-commits
@@ -24,15 +24,38 @@ using namespace llvm; -/// Get the __llvm_prf_cnts section. -Expected getCountersSection(const object::ObjectFile ) { +namespace llvm { +// Deprecated. Use -profile-correlate=debug-info. +cl::opt DebugInfoCorrelate( +"debug-info-correlate", +

[clang] [IRPGO][ValueProfile] Instrument virtual table address that could be used to do virtual table address comparision for indirect-call-promotion. (PR #66825)

2023-10-23 Thread David Li via cfe-commits
@@ -12,27 +12,96 @@ #ifndef LLVM_ANALYSIS_INDIRECTCALLVISITOR_H #define LLVM_ANALYSIS_INDIRECTCALLVISITOR_H +#include "llvm/ADT/SetVector.h" #include "llvm/IR/InstVisitor.h" #include namespace llvm { -// Visitor class that finds all indirect call. +// Visitor class that

[clang] [IRPGO][ValueProfile] Instrument virtual table address that could be used to do virtual table address comparision for indirect-call-promotion. (PR #66825)

2023-10-23 Thread David Li via cfe-commits
@@ -12,27 +12,96 @@ #ifndef LLVM_ANALYSIS_INDIRECTCALLVISITOR_H #define LLVM_ANALYSIS_INDIRECTCALLVISITOR_H +#include "llvm/ADT/SetVector.h" #include "llvm/IR/InstVisitor.h" #include namespace llvm { -// Visitor class that finds all indirect call. +// Visitor class that

[clang] [Profile] Add binary profile correlation to offload profile metadata at runtime. (PR #69493)

2023-10-23 Thread David Li via cfe-commits
david-xl wrote: > > This should works with PGO when value profiling is disabled > > Is this not compatible with value profiling? or just not implemented yet? Not compatible, but this feature is mainly for coverage testing. https://github.com/llvm/llvm-project/pull/69493

[clang] [PGO] Add ability to mark cold functions as optsize/minsize/optnone (PR #69030)

2023-10-19 Thread David Li via cfe-commits
@@ -0,0 +1,65 @@ +//===--===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier:

[clang] [Profile] Refactor profile correlation. (PR #69656)

2023-10-19 Thread David Li via cfe-commits
https://github.com/david-xl approved this pull request. https://github.com/llvm/llvm-project/pull/69656 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Profile] Add binary profile correlation to offload profile metadata at runtime. (PR #69493)

2023-10-19 Thread David Li via cfe-commits
@@ -98,13 +99,16 @@ extern cl::opt PrintPipelinePasses; static cl::opt ClSanitizeOnOptimizerEarlyEP( "sanitizer-early-opt-ep", cl::Optional, cl::desc("Insert sanitizers on OptimizerEarlyEP."), cl::init(false)); -} + +extern cl::opt ProfileCorrelate;

[clang] [Profile] Add binary profile correlation to offload profile metadata at runtime. (PR #69493)

2023-10-19 Thread David Li via cfe-commits
@@ -540,10 +540,10 @@ Error RawInstrProfReader::readHeader( "\nPLEASE update this tool to version in the raw profile, or " "regenerate raw profile with expected version.") .str()); - if (useDebugInfoCorrelate() &&

[clang] [Profile] Add binary profile correlation to offload profile metadata at runtime. (PR #69493)

2023-10-19 Thread David Li via cfe-commits
@@ -61,9 +64,20 @@ uint64_t __llvm_profile_get_num_data(const __llvm_profile_data *Begin, COMPILER_RT_VISIBILITY uint64_t __llvm_profile_get_data_size(const __llvm_profile_data *Begin, const __llvm_profile_data *End) { + if

[clang] [Profile] Add binary profile correlation to offload profile metadata at runtime. (PR #69493)

2023-10-19 Thread David Li via cfe-commits
@@ -259,19 +259,19 @@ lprofWriteDataImpl(ProfDataWriter *Writer, const __llvm_profile_data *DataBegin, const char *CountersBegin, const char *CountersEnd, VPDataReaderType *VPDataReader, const char *NamesBegin, const

[clang] [Profile] Add binary profile correlation to offload profile metadata at runtime. (PR #69493)

2023-10-19 Thread David Li via cfe-commits
@@ -61,9 +64,20 @@ uint64_t __llvm_profile_get_num_data(const __llvm_profile_data *Begin, COMPILER_RT_VISIBILITY uint64_t __llvm_profile_get_data_size(const __llvm_profile_data *Begin, const __llvm_profile_data *End) { + if

[clang] [Profile] Add binary profile correlation to offload profile metadata at runtime. (PR #69493)

2023-10-19 Thread David Li via cfe-commits
@@ -267,6 +267,9 @@ uint64_t __llvm_profile_get_num_data(const __llvm_profile_data *Begin, uint64_t __llvm_profile_get_data_size(const __llvm_profile_data *Begin, const __llvm_profile_data *End); +/*! \brief Get the size of the profile

[clang] [Profile] Add binary profile correlation to offload profile metadata at runtime. (PR #69493)

2023-10-19 Thread David Li via cfe-commits
@@ -66,8 +66,9 @@ int __llvm_profile_check_compatibility(const char *ProfileData, Header->NumCounters != __llvm_profile_get_num_counters(__llvm_profile_begin_counters(), __llvm_profile_end_counters()) || -

[clang] [Profile] Add binary profile correlation to offload profile metadata at runtime. (PR #69493)

2023-10-19 Thread David Li via cfe-commits
@@ -374,6 +376,14 @@ class RawInstrProfReader : public InstrProfReader { return (Version & VARIANT_MASK_DBG_CORRELATE) != 0; } + bool useBinaryCorrelate() const override { +return (Version & VARIANT_MASK_BIN_CORRELATE) != 0; + } + + bool useCorrelate() const {

[clang] [Profile] Add binary profile correlation to offload profile metadata at runtime. (PR #69493)

2023-10-19 Thread David Li via cfe-commits
@@ -98,13 +99,16 @@ extern cl::opt PrintPipelinePasses; static cl::opt ClSanitizeOnOptimizerEarlyEP( "sanitizer-early-opt-ep", cl::Optional, cl::desc("Insert sanitizers on OptimizerEarlyEP."), cl::init(false)); -} + +extern cl::opt ProfileCorrelate;

[clang] [Profile] Add binary profile correlation to offload profile metadata at runtime. (PR #69493)

2023-10-18 Thread David Li via cfe-commits
david-xl wrote: Can you send a RFC for this enhancement ? The first 2 paragraph of this PR can be expanded a little more to show motivations (RAM saving, or raw profile size saving and why) and the savings data. https://github.com/llvm/llvm-project/pull/69493

[clang-tools-extra] [llvm-profdata] Do not create numerical strings for MD5 function names read from a Sample Profile. (PR #66164)

2023-10-16 Thread David Li via cfe-commits
https://github.com/david-xl approved this pull request. https://github.com/llvm/llvm-project/pull/66164 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [PGO] Add ability to mark cold functions as optsize/minsize/optnone (PR #69030)

2023-10-16 Thread David Li via cfe-commits
@@ -0,0 +1,65 @@ +//===--===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier:

[clang] [PGO] Add ability to mark cold functions as optsize/minsize/optnone (PR #69030)

2023-10-13 Thread David Li via cfe-commits
@@ -202,6 +202,18 @@ static cl::opt cl::desc("Path to the profile remapping file."), cl::Hidden); +static cl::opt PGOColdFuncAttr( +"pgo-cold-func-attr", cl::init(PGOOptions::ColdFuncAttr::None), cl::Hidden,

[clang] [PGO] Add ability to mark cold functions as optsize/minsize/optnone (PR #69030)

2023-10-13 Thread David Li via cfe-commits
@@ -0,0 +1,65 @@ +//===--===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier:

[clang] [PGO] Add ability to mark cold functions as optsize/minsize/optnone (PR #69030)

2023-10-13 Thread David Li via cfe-commits
@@ -27,10 +27,12 @@ class FileSystem; struct PGOOptions { enum PGOAction { NoAction, IRInstr, IRUse, SampleUse }; enum CSPGOAction { NoCSAction, CSIRInstr, CSIRUse }; + enum class ColdFuncAttr { None, OptSize, MinSize, OptNone }; david-xl wrote: None -->

[clang] [PGO] Add ability to mark cold functions as optsize/minsize/optnone (PR #69030)

2023-10-13 Thread David Li via cfe-commits
@@ -44,6 +46,7 @@ struct PGOOptions { std::string MemoryProfile; PGOAction Action; CSPGOAction CSAction; + ColdFuncAttr ColdType; david-xl wrote: ColdType --> ColdOptType https://github.com/llvm/llvm-project/pull/69030

[clang] [PGO] Add ability to mark cold functions as optsize/minsize/optnone (PR #69030)

2023-10-13 Thread David Li via cfe-commits
@@ -27,10 +27,12 @@ class FileSystem; struct PGOOptions { enum PGOAction { NoAction, IRInstr, IRUse, SampleUse }; enum CSPGOAction { NoCSAction, CSIRInstr, CSIRUse }; + enum class ColdFuncAttr { None, OptSize, MinSize, OptNone }; david-xl wrote: Even

[clang-tools-extra] [llvm-profdata] Do not create numerical strings for MD5 function names read from a Sample Profile. (PR #66164)

2023-10-12 Thread David Li via cfe-commits
@@ -902,12 +890,16 @@ std::error_code SampleProfileReaderExtBinaryBase::readFuncProfiles() { for (const auto : FuncOffsetList) { const auto = NameOffset.first; auto FName = FContext.getName(); +StringRef FNameString; +if (!useMD5()) { +

[clang-tools-extra] [llvm-profdata] Do not create numerical strings for MD5 function names read from a Sample Profile. (PR #66164)

2023-10-12 Thread David Li via cfe-commits
@@ -902,12 +890,16 @@ std::error_code SampleProfileReaderExtBinaryBase::readFuncProfiles() { for (const auto : FuncOffsetList) { const auto = NameOffset.first; auto FName = FContext.getName(); +StringRef FNameString; +if (!useMD5()) {

[clang] [llvm-profdata] Do not create numerical strings for MD5 function names read from a Sample Profile. (PR #66164)

2023-10-12 Thread David Li via cfe-commits
@@ -902,12 +890,16 @@ std::error_code SampleProfileReaderExtBinaryBase::readFuncProfiles() { for (const auto : FuncOffsetList) { const auto = NameOffset.first; auto FName = FContext.getName(); +StringRef FNameString; +if (!useMD5()) { +

[clang] [llvm-profdata] Do not create numerical strings for MD5 function names read from a Sample Profile. (PR #66164)

2023-10-12 Thread David Li via cfe-commits
@@ -0,0 +1,222 @@ +//===--- ProfileFuncRef.h - Sample profile function name ---*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier:

[clang] [llvm-profdata] Do not create numerical strings for MD5 function names read from a Sample Profile. (PR #66164)

2023-10-12 Thread David Li via cfe-commits
@@ -902,12 +890,16 @@ std::error_code SampleProfileReaderExtBinaryBase::readFuncProfiles() { for (const auto : FuncOffsetList) { const auto = NameOffset.first; auto FName = FContext.getName(); +StringRef FNameString; david-xl

[clang] [llvm-profdata] Do not create numerical strings for MD5 function names read from a Sample Profile. (PR #66164)

2023-10-12 Thread David Li via cfe-commits
@@ -0,0 +1,222 @@ +//===--- ProfileFuncRef.h - Sample profile function name ---*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier:

[clang] [IRPGO][ValueProfile] Instrument virtual table address that could be used to do virtual table address comparision for indirect-call-promotion. (PR #66825)

2023-10-12 Thread David Li via cfe-commits
david-xl wrote: The performance win depends a lot on value distribution. For large copies, using SIMD with nontemporal hint is the way to go. https://github.com/llvm/llvm-project/pull/66825 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang-tools-extra] [llvm-profdata] Do not create numerical strings for MD5 function names read from a Sample Profile. (PR #66164)

2023-10-09 Thread David Li via cfe-commits
@@ -0,0 +1,129 @@ +//===--- HashKeyMap.h - Wrapper for maps using hash value key ---*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier:

[clang-tools-extra] [llvm-profdata] Do not create numerical strings for MD5 function names read from a Sample Profile. (PR #66164)

2023-10-09 Thread David Li via cfe-commits
@@ -902,12 +890,16 @@ std::error_code SampleProfileReaderExtBinaryBase::readFuncProfiles() { for (const auto : FuncOffsetList) { const auto = NameOffset.first; auto FName = FContext.getName(); +StringRef FNameString; +if (!useMD5()) { +

[clang-tools-extra] [llvm-profdata] Do not create numerical strings for MD5 function names read from a Sample Profile. (PR #66164)

2023-10-09 Thread David Li via cfe-commits
@@ -902,12 +890,16 @@ std::error_code SampleProfileReaderExtBinaryBase::readFuncProfiles() { for (const auto : FuncOffsetList) { const auto = NameOffset.first; auto FName = FContext.getName(); +StringRef FNameString; +if (!useMD5()) {

[clang] [llvm-profdata] Do not create numerical strings for MD5 function names read from a Sample Profile. (PR #66164)

2023-10-09 Thread David Li via cfe-commits
@@ -0,0 +1,129 @@ +//===--- HashKeyMap.h - Wrapper for maps using hash value key ---*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier:

[clang] [llvm-profdata] Do not create numerical strings for MD5 function names read from a Sample Profile. (PR #66164)

2023-10-09 Thread David Li via cfe-commits
@@ -902,12 +890,16 @@ std::error_code SampleProfileReaderExtBinaryBase::readFuncProfiles() { for (const auto : FuncOffsetList) { const auto = NameOffset.first; auto FName = FContext.getName(); +StringRef FNameString; david-xl

[clang] [llvm-profdata] Do not create numerical strings for MD5 function names read from a Sample Profile. (PR #66164)

2023-10-09 Thread David Li via cfe-commits
@@ -902,12 +890,16 @@ std::error_code SampleProfileReaderExtBinaryBase::readFuncProfiles() { for (const auto : FuncOffsetList) { const auto = NameOffset.first; auto FName = FContext.getName(); +StringRef FNameString; +if (!useMD5()) { +

[clang] [llvm-profdata] Do not create numerical strings for MD5 function names read from a Sample Profile. (PR #66164)

2023-10-09 Thread David Li via cfe-commits
@@ -902,12 +890,16 @@ std::error_code SampleProfileReaderExtBinaryBase::readFuncProfiles() { for (const auto : FuncOffsetList) { const auto = NameOffset.first; auto FName = FContext.getName(); +StringRef FNameString; +if (!useMD5()) {

[clang] [IRPGO][ValueProfile] Instrument virtual table address that could be used to do virtual table address comparision for indirect-call-promotion. (PR #66825)

2023-10-09 Thread David Li via cfe-commits
https://github.com/david-xl commented: Is there a need to have a separate vtable name section? Merging the vtable names with function name table can make the implementation simpler. https://github.com/llvm/llvm-project/pull/66825 ___ cfe-commits

[clang] [IRPGO][ValueProfile] Instrument virtual table address that could be used to do virtual table address comparision for indirect-call-promotion. (PR #66825)

2023-10-09 Thread David Li via cfe-commits
https://github.com/david-xl edited https://github.com/llvm/llvm-project/pull/66825 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [IRPGO][ValueProfile] Instrument virtual table address that could be used to do virtual table address comparision for indirect-call-promotion. (PR #66825)

2023-10-09 Thread David Li via cfe-commits
@@ -177,13 +195,22 @@ VALUE_PROF_FUNC_PARAM(uint32_t, CounterIndex, Type::getInt32Ty(Ctx)) VALUE_PROF_KIND(IPVK_IndirectCallTarget, 0, "indirect call target") /* For memory intrinsic functions size profiling. */ VALUE_PROF_KIND(IPVK_MemOPSize, 1, "memory intrinsic functions

[clang] [IRPGO][ValueProfile] Instrument virtual table address that could be used to do virtual table address comparision for indirect-call-promotion. (PR #66825)

2023-10-09 Thread David Li via cfe-commits
https://github.com/david-xl commented: Is there a need to have a separate vtable name section? Merging the vtable names with function name table can make the implementation simpler. https://github.com/llvm/llvm-project/pull/66825 ___ cfe-commits

[clang-tools-extra] [llvm-profdata] Do not create numerical strings for MD5 function names read from a Sample Profile. (PR #66164)

2023-09-27 Thread David Li via cfe-commits
@@ -1048,27 +1052,29 @@ class FunctionSamples { }; if (isDeclaration(SymbolMap.lookup(getFuncName( { // Add to the import list only when it's defined out of module. - S.insert(getGUID(getName())); + S.insert(getGUID()); } // Import hot

[clang] [llvm-profdata] Do not create numerical strings for MD5 function names read from a Sample Profile. (PR #66164)

2023-09-27 Thread David Li via cfe-commits
@@ -1048,27 +1052,29 @@ class FunctionSamples { }; if (isDeclaration(SymbolMap.lookup(getFuncName( { // Add to the import list only when it's defined out of module. - S.insert(getGUID(getName())); + S.insert(getGUID()); } // Import hot

[clang] [llvm-profdata] Do not create numerical strings for MD5 function names read from a Sample Profile. (PR #66164)

2023-09-26 Thread David Li via cfe-commits
david-xl wrote: The change looks good to me, but wait for other reviewers to chime in as well. Also a good idea to run tests with sanitizers on. https://github.com/llvm/llvm-project/pull/66164 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [IRPGO][ValueProfile] Instrument virtual table address that could be used to do virtual table address comparision for indirect-call-promotion. (PR #66825)

2023-09-21 Thread David Li via cfe-commits
@@ -686,9 +708,11 @@ serializeValueProfDataFrom(ValueProfRecordClosure *Closure, than WIN32 */ #define INSTR_PROF_DATA_COMMON __llvm_prf_data #define INSTR_PROF_NAME_COMMON __llvm_prf_names +#define INSTR_PROF_VNAME_COMMON __llvm_prf_vnames david-xl wrote:

[clang] [IRPGO][ValueProfile] Instrument virtual table address that could be used to do virtual table address comparision for indirect-call-promotion. (PR #66825)

2023-09-21 Thread David Li via cfe-commits
@@ -305,13 +320,24 @@ lprofWriteDataImpl(ProfDataWriter *Writer, const __llvm_profile_data *DataBegin, /* Write the profile header. */ ProfDataIOVec IOVec[] = {{, sizeof(__llvm_profile_header), 1, 0}}; + // printf("Size of profile header is %d\n", + //

[clang] [IRPGO][ValueProfile] Instrument virtual table address that could be used to do virtual table address comparision for indirect-call-promotion. (PR #66825)

2023-09-21 Thread David Li via cfe-commits
@@ -92,6 +92,19 @@ INSTR_PROF_DATA(const uint16_t, Int16ArrayTy, NumValueSites[IPVK_Last+1], \ /* INSTR_PROF_DATA end. */ +#ifndef INSTR_PROF_VTABLE_DATA +#define INSTR_PROF_VTABLE_DATA(Type, LLVMType, Name, Initializer) +#else +#define INSTR_PROF_VTABLE_DATA_DEFINED

[clang] [IRPGO][ValueProfile] Instrument virtual table address that could be used to do virtual table address comparision for indirect-call-promotion. (PR #66825)

2023-09-21 Thread David Li via cfe-commits
@@ -272,18 +279,26 @@ lprofWriteDataImpl(ProfDataWriter *Writer, const __llvm_profile_data *DataBegin, const uint64_t NumCounters = __llvm_profile_get_num_counters(CountersBegin, CountersEnd); const uint64_t NamesSize = DebugInfoCorrelate ? 0 : NamesEnd -

[clang] [IRPGO][ValueProfile] Instrument virtual table address that could be used to do virtual table address comparision for indirect-call-promotion. (PR #66825)

2023-09-21 Thread David Li via cfe-commits
@@ -124,9 +124,27 @@ int __llvm_profile_merge_from_buffer(const char *ProfileData, SrcCountersEnd = SrcCountersStart + Header->NumCounters * __llvm_profile_counter_entry_size(); SrcNameStart = SrcCountersEnd; - SrcValueProfDataStart = + // This is to

[clang] [llvm-profdata] Do not create numerical strings for MD5 function names read from a Sample Profile. (PR #66164)

2023-09-20 Thread David Li via cfe-commits
@@ -0,0 +1,226 @@ +//===--- ProfileFuncRef.h - Sample profile function name ---*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier:

[clang] [llvm-profdata] Do not create numerical strings for MD5 function names read from a Sample Profile. (PR #66164)

2023-09-20 Thread David Li via cfe-commits
@@ -643,14 +648,11 @@ class SampleContext { uint64_t getHashCode() const { if (hasContext()) return hash_value(getContextFrames()); - -// For non-context function name, use its MD5 as hash value, so that it is -// consistent with the profile map's key. -

[clang] [llvm-profdata] Do not create numerical strings for MD5 function names read from a Sample Profile. (PR #66164)

2023-09-20 Thread David Li via cfe-commits
@@ -574,7 +578,7 @@ class SampleContext { ContextStr = ContextStr.substr(1, ContextStr.size() - 2); StringRef ContextRemain = ContextStr; StringRef ChildContext; -StringRef CalleeName; +ProfileFuncRef CalleeName; david-xl wrote: CalleeName

[clang-tools-extra] [llvm-profdata] Do not create numerical strings for MD5 function names read from a Sample Profile. (PR #66164)

2023-09-20 Thread David Li via cfe-commits
@@ -0,0 +1,225 @@ +//===--- ProfileFuncRef.h - Sample profile function name ---*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier:

[clang] [llvm-profdata] Do not create numerical strings for MD5 function names read from a Sample Profile. (PR #66164)

2023-09-20 Thread David Li via cfe-commits
@@ -1135,12 +1141,12 @@ class FunctionSamples { /// translate \p Name in current FunctionSamples into its original name /// by looking up in the function map GUIDToFuncNameMap. /// If the original name doesn't exist in the map, return empty StringRef. - StringRef

[clang] [llvm-profdata] Do not create numerical strings for MD5 function names read from a Sample Profile. (PR #66164)

2023-09-20 Thread David Li via cfe-commits
@@ -715,7 +717,7 @@ class SampleContext { private: /// Mangled name of the function. - StringRef Name; + ProfileFuncRef Name; david-xl wrote: Name --> Func https://github.com/llvm/llvm-project/pull/66164 ___

[clang-tools-extra] [llvm-profdata] Do not create numerical strings for MD5 function names read from a Sample Profile. (PR #66164)

2023-09-20 Thread David Li via cfe-commits
@@ -1048,27 +1052,29 @@ class FunctionSamples { }; if (isDeclaration(SymbolMap.lookup(getFuncName( { // Add to the import list only when it's defined out of module. - S.insert(getGUID(getName())); + S.insert(getGUID()); } // Import hot

[clang-tools-extra] [llvm-profdata] Do not create numerical strings for MD5 function names read from a Sample Profile. (PR #66164)

2023-09-20 Thread David Li via cfe-commits
@@ -574,7 +578,7 @@ class SampleContext { ContextStr = ContextStr.substr(1, ContextStr.size() - 2); StringRef ContextRemain = ContextStr; StringRef ChildContext; -StringRef CalleeName; +ProfileFuncRef CalleeName; david-xl wrote: CalleeName

[clang-tools-extra] [llvm-profdata] Do not create numerical strings for MD5 function names read from a Sample Profile. (PR #66164)

2023-09-20 Thread David Li via cfe-commits
@@ -0,0 +1,226 @@ +//===--- ProfileFuncRef.h - Sample profile function name ---*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier:

[clang] [llvm-profdata] Do not create numerical strings for MD5 function names read from a Sample Profile. (PR #66164)

2023-09-20 Thread David Li via cfe-commits
@@ -0,0 +1,225 @@ +//===--- ProfileFuncRef.h - Sample profile function name ---*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier:

[clang-tools-extra] [llvm-profdata] Do not create numerical strings for MD5 function names read from a Sample Profile. (PR #66164)

2023-09-20 Thread David Li via cfe-commits
@@ -643,14 +648,11 @@ class SampleContext { uint64_t getHashCode() const { if (hasContext()) return hash_value(getContextFrames()); - -// For non-context function name, use its MD5 as hash value, so that it is -// consistent with the profile map's key. -

[clang] [llvm-profdata] Do not create numerical strings for MD5 function names read from a Sample Profile. (PR #66164)

2023-09-20 Thread David Li via cfe-commits
@@ -1048,27 +1052,29 @@ class FunctionSamples { }; if (isDeclaration(SymbolMap.lookup(getFuncName( { // Add to the import list only when it's defined out of module. - S.insert(getGUID(getName())); + S.insert(getGUID()); } // Import hot

[clang-tools-extra] [llvm-profdata] Do not create numerical strings for MD5 function names read from a Sample Profile. (PR #66164)

2023-09-20 Thread David Li via cfe-commits
@@ -1048,27 +1052,29 @@ class FunctionSamples { }; if (isDeclaration(SymbolMap.lookup(getFuncName( { // Add to the import list only when it's defined out of module. - S.insert(getGUID(getName())); + S.insert(getGUID()); } // Import hot

[clang-tools-extra] [llvm-profdata] Do not create numerical strings for MD5 function names read from a Sample Profile. (PR #66164)

2023-09-20 Thread David Li via cfe-commits
@@ -0,0 +1,225 @@ +//===--- ProfileFuncRef.h - Sample profile function name ---*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier:

[clang-tools-extra] [llvm-profdata] Do not create numerical strings for MD5 function names read from a Sample Profile. (PR #66164)

2023-09-20 Thread David Li via cfe-commits
@@ -537,6 +538,9 @@ class SampleContext { assert(!Name.empty() && "Name is empty"); } + SampleContext(ProfileFuncRef Name) david-xl wrote: Name ->Func https://github.com/llvm/llvm-project/pull/66164

[clang-tools-extra] [llvm-profdata] Do not create numerical strings for MD5 function names read from a Sample Profile. (PR #66164)

2023-09-20 Thread David Li via cfe-commits
@@ -715,7 +717,7 @@ class SampleContext { private: /// Mangled name of the function. - StringRef Name; + ProfileFuncRef Name; david-xl wrote: Name --> Func https://github.com/llvm/llvm-project/pull/66164 ___

[clang-tools-extra] [llvm-profdata] Do not create numerical strings for MD5 function names read from a Sample Profile. (PR #66164)

2023-09-20 Thread David Li via cfe-commits
@@ -1135,12 +1141,12 @@ class FunctionSamples { /// translate \p Name in current FunctionSamples into its original name /// by looking up in the function map GUIDToFuncNameMap. /// If the original name doesn't exist in the map, return empty StringRef. - StringRef

[clang] [llvm-profdata] Do not create numerical strings for MD5 function names read from a Sample Profile. (PR #66164)

2023-09-20 Thread David Li via cfe-commits
@@ -476,12 +471,12 @@ enum ContextAttributeMask { // Represents a context frame with function name and line location struct SampleContextFrame { - StringRef FuncName; + ProfileFuncRef FuncName; david-xl wrote: Nit: FuncName--> Func

[clang] [llvm-profdata] Do not create numerical strings for MD5 function names read from a Sample Profile. (PR #66164)

2023-09-20 Thread David Li via cfe-commits
@@ -537,6 +538,9 @@ class SampleContext { assert(!Name.empty() && "Name is empty"); } + SampleContext(ProfileFuncRef Name) david-xl wrote: Name ->Func https://github.com/llvm/llvm-project/pull/66164

[clang] [IRPGO][ValueProfile] Instrument virtual table address that could be used to do virtual table address comparision for indirect-call-promotion. (PR #66825)

2023-09-19 Thread David Li via cfe-commits
david-xl wrote: > The work sounds interesting. Can you provide a bit more context about it? > Will it be used to improve ICP when it's sufficient to just compare the > vtable address instead of the vfunc address? yes -- it can not only eliminate vtable load, but also enable target check

[clang] [IRPGO][ValueProfile] Instrument virtual table address that could be used to do virtual table address comparision for indirect-call-promotion. (PR #66825)

2023-09-19 Thread David Li via cfe-commits
@@ -276,6 +286,12 @@ uint64_t __llvm_profile_get_num_counters(const char *Begin, const char *End); /*! \brief Get the size of the profile counters section in bytes. */ uint64_t __llvm_profile_get_counters_size(const char *Begin, const char *End); +uint64_t

[clang] [IRPGO][ValueProfile] Instrument virtual table address that could be used to do virtual table address comparision for indirect-call-promotion. (PR #66825)

2023-09-19 Thread David Li via cfe-commits
@@ -276,6 +286,12 @@ uint64_t __llvm_profile_get_num_counters(const char *Begin, const char *End); /*! \brief Get the size of the profile counters section in bytes. */ uint64_t __llvm_profile_get_counters_size(const char *Begin, const char *End); +uint64_t

[clang] [IRPGO][ValueProfile] Instrument virtual table address that could be used to do virtual table address comparision for indirect-call-promotion. (PR #66825)

2023-09-19 Thread David Li via cfe-commits
@@ -0,0 +1,139 @@ +; RUN: opt < %s -passes=pgo-instr-gen -S | FileCheck %s --check-prefix=GEN +; RUN: opt < %s -passes=pgo-instr-gen,instrprof -S | FileCheck %s --check-prefix=LOWER + +target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"

[clang] [IRPGO][ValueProfile] Instrument virtual table address that could be used to do virtual table address comparision for indirect-call-promotion. (PR #66825)

2023-09-19 Thread David Li via cfe-commits
@@ -276,6 +286,12 @@ uint64_t __llvm_profile_get_num_counters(const char *Begin, const char *End); /*! \brief Get the size of the profile counters section in bytes. */ uint64_t __llvm_profile_get_counters_size(const char *Begin, const char *End); +uint64_t

Re: [PATCH] D104099: [NewPM] Remove SpeculateAroundPHIs pass from pipeline

2021-06-14 Thread Xinliang David Li via cfe-commits
On Mon, Jun 14, 2021 at 3:59 PM Roman Lebedev via Phabricator < revi...@reviews.llvm.org> wrote: > lebedev.ri added a subscriber: MaskRay. > lebedev.ri added a comment. > > In D104099#2815531 , @wenlei > wrote: > > > In D104099#2814167

Re: [PATCH] D84261: [PGO] Supporting code for always instrumenting entry block

2020-08-17 Thread Xinliang David Li via cfe-commits
I think you are right -- the two files need to be in sync. On Mon, Aug 17, 2020 at 1:17 PM Pavel Kosov via Phabricator via llvm-commits wrote: > kpdev42 added inline comments. > > > > Comment at: llvm/include/llvm/ProfileData/InstrProfData.inc:676 > #define

Re: [PATCH] D84782: [PGO] Include the mem ops into the function hash.

2020-07-29 Thread Xinliang David Li via cfe-commits
right. It occurred to me during review, but did not think of the hard coded values in proftext depends on LE. On Wed, Jul 29, 2020 at 3:04 PM Hiroshi Yamauchi via Phabricator < revi...@reviews.llvm.org> wrote: > yamauchi added a comment. > > Builtbot failure: >

Re: [PATCH] D63155: [clang][NewPM] Fix broken profile test

2019-06-28 Thread Xinliang David Li via cfe-commits
I agree that the test coverage needs to be improved eg better check etc. David On Fri, Jun 28, 2019 at 5:21 PM Chandler Carruth via Phabricator via llvm-commits wrote: > chandlerc added a comment. > > In D63155#1563275 , @xur wrote: > > > In

Re: [PATCH] D45454: Make __gcov_flush visible outside a shared library

2018-06-25 Thread Xinliang David Li via cfe-commits
I don't have an objection having another interface which is just a simple wrapper to __gcov_flush but with default visibility. Also clearly document its usage and behavior. David On Mon, Jun 25, 2018 at 10:12 AM, Chih-Hung Hsieh via Phabricator via llvm-commits wrote: > chh added a comment. >

Re: [PATCH] D45454: Make __gcov_flush visible outside a shared library

2018-04-11 Thread Xinliang David Li via cfe-commits
On Wed, Apr 11, 2018 at 11:31 AM, Chih-Hung Hsieh via Phabricator via llvm-commits wrote: > chh added a comment. > > Yes, calling `__gcov_flush` within .so files are different, > but it's a revert of https://reviews.llvm.org/D38124. > I think

Re: [PATCH] D36562: [Bitfield] Make the bitfield a separate location if it has width of legal integer type and its bit offset is naturally aligned for the type

2017-09-04 Thread Xinliang David Li via cfe-commits
On Mon, Sep 4, 2017 at 1:57 AM, Chandler Carruth wrote: > On Sun, Sep 3, 2017 at 10:41 PM Hal Finkel via llvm-commits < > llvm-comm...@lists.llvm.org> wrote: > >> Nevertheless, I think that you've convinced me that this is a least-bad >> solution. I'll want a flag preserving

Re: [PATCH] D36562: [Bitfield] Make the bitfield a separate location if it has width of legal integer type and its bit offset is naturally aligned for the type

2017-09-04 Thread Xinliang David Li via cfe-commits
On Mon, Sep 4, 2017 at 9:17 AM, Hal Finkel wrote: > > On 09/04/2017 03:57 AM, Chandler Carruth wrote: > > On Sun, Sep 3, 2017 at 10:41 PM Hal Finkel via llvm-commits < > llvm-comm...@lists.llvm.org> wrote: > >> Nevertheless, I think that you've convinced me that this is a

Re: [PATCH] D36562: [Bitfield] Make the bitfield a separate location if it has width of legal integer type and its bit offset is naturally aligned for the type

2017-09-03 Thread Xinliang David Li via cfe-commits
On Sun, Sep 3, 2017 at 9:23 PM, Hal Finkel wrote: > > On 09/03/2017 11:06 PM, Xinliang David Li wrote: > > I think we can think this in another way. > > For modern CPU architectures which supports store forwarding with store > queues, it is generally not "safe" to blindly do

Re: [PATCH] D36562: [Bitfield] Make the bitfield a separate location if it has width of legal integer type and its bit offset is naturally aligned for the type

2017-09-03 Thread Xinliang David Li via cfe-commits
I think we can think this in another way. For modern CPU architectures which supports store forwarding with store queues, it is generally not "safe" to blindly do local optimizations to widen the load/stores without sophisticated inter-procedural analysis. Doing so will run the risk of greatly

Re: [PATCH] D36562: [Bitfield] Make the bitfield a separate location if it has width of legal integer type and its bit offset is naturally aligned for the type

2017-09-03 Thread Xinliang David Li via cfe-commits
Store forwarding stall cost is usually much higher compared with a load hitting L1 cache. For instance, on Haswell, the latter is ~4 cycles, while the store forwarding stalls cost about 10 cycles more than a successful store forwarding, which is roughly 15 cycles. In some scenarios, the store

Re: [PATCH] D36562: [Bitfield] Make the bitfield a separate location if it has width of legal integer type and its bit offset is naturally aligned for the type

2017-08-22 Thread Xinliang David Li via cfe-commits
< >> llvm-comm...@lists.llvm.org> wrote: >> >>> On Tue, Aug 22, 2017 at 7:03 PM Xinliang David Li via cfe-commits < >>> cfe-commits@lists.llvm.org> wrote: >>> >>>> On Tue, Aug 22, 2017 at 6:37 PM, Chandler Carruth via Phabricator <

Re: [PATCH] D36562: [Bitfield] Make the bitfield a separate location if it has width of legal integer type and its bit offset is naturally aligned for the type

2017-08-22 Thread Xinliang David Li via cfe-commits
On Tue, Aug 22, 2017 at 7:10 PM, Chandler Carruth via llvm-commits < llvm-comm...@lists.llvm.org> wrote: > On Tue, Aug 22, 2017 at 7:03 PM Xinliang David Li via cfe-commits < > cfe-commits@lists.llvm.org> wrote: > >> On Tue, Aug 22, 2017 at 6:37 PM, Chandler Carrut

Re: [PATCH] D36562: [Bitfield] Make the bitfield a separate location if it has width of legal integer type and its bit offset is naturally aligned for the type

2017-08-22 Thread Xinliang David Li via cfe-commits
On Tue, Aug 22, 2017 at 6:37 PM, Chandler Carruth via Phabricator < revi...@reviews.llvm.org> wrote: > chandlerc added a comment. > > I'm really not a fan of the degree of complexity and subtlety that this > introduces into the frontend, all to allow particular backend optimizations. > > I feel

r305325 - Preserve cold attribute for function decls

2017-06-13 Thread Xinliang David Li via cfe-commits
Author: davidxl Date: Tue Jun 13 16:14:07 2017 New Revision: 305325 URL: http://llvm.org/viewvc/llvm-project?rev=305325=rev Log: Preserve cold attribute for function decls Differential Revision: http://reviews.llvm.org/D34133 Modified: cfe/trunk/lib/CodeGen/CGCall.cpp

r300304 - Fix use after free error

2017-04-13 Thread Xinliang David Li via cfe-commits
Author: davidxl Date: Thu Apr 13 23:14:29 2017 New Revision: 300304 URL: http://llvm.org/viewvc/llvm-project?rev=300304=rev Log: Fix use after free error Modified: cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp Modified: cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp URL:

r300301 - Remove unused function /nfc

2017-04-13 Thread Xinliang David Li via cfe-commits
Author: davidxl Date: Thu Apr 13 22:01:25 2017 New Revision: 300301 URL: http://llvm.org/viewvc/llvm-project?rev=300301=rev Log: Remove unused function /nfc Modified: cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp Modified: cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp URL:

r300279 - [Profile] PE binary coverage bug fix

2017-04-13 Thread Xinliang David Li via cfe-commits
Author: davidxl Date: Thu Apr 13 18:37:21 2017 New Revision: 300279 URL: http://llvm.org/viewvc/llvm-project?rev=300279=rev Log: [Profile] PE binary coverage bug fix PR/32584 Differential Revision: https://reviews.llvm.org/D32023 Modified: cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp

Re: [PATCH] D24097: Add testcases for PR30188

2016-08-31 Thread David Li via cfe-commits
davidxl added inline comments. Comment at: clang/test/CodeGen/pr30188.c:3 @@ +2,3 @@ + +// Check that optimizers are able to optimize the number of loads in the loop. +// CHECK: load Can you just do ... | grep load | count 3 Comment at:

<    1   2   3   4   >