[clang] [compiler-rt] [libc] [lld] [lldb] [llvm] [mlir] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-11-08 Thread Lei Wang via cfe-commits
wlei-llvm wrote: > > > > > > Ping @wlei-llvm > > > > > > > > > > > > > > > Sorry for the delay. The new version addressed my last comment (with > > > > > just minor nits). However, I didn't fully follow the new features > > > > > related to `ProbeMatchSpecs` stuffs. Could you add more descrip

[clang] [compiler-rt] [libc] [lld] [lldb] [llvm] [mlir] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-11-08 Thread Lei Wang via cfe-commits
https://github.com/wlei-llvm approved this pull request. LGTM, thanks for addressing the comments! https://github.com/llvm/llvm-project/pull/99891 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/c

[clang] [compiler-rt] [libc] [lld] [lldb] [llvm] [mlir] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-11-08 Thread Lei Wang via cfe-commits
wlei-llvm wrote: > > > > Ping @wlei-llvm > > > > > > > > > Sorry for the delay. The new version addressed my last comment (with just > > > minor nits). However, I didn't fully follow the new features related to > > > `ProbeMatchSpecs` stuffs. Could you add more descriptions to the diff > > >

[clang] Reapply "[Clang][Sema] Always use latest redeclaration of primary template" (PR #114569)

2024-11-07 Thread Lei Wang via cfe-commits
wlei-llvm wrote: Hi, here is the reduced repro (not perfect, but was as far as I can get), thanks! ``` namespace std { template _Tp __declval(long); template auto declval() noexcept -> decltype(__declval<_Tp>(0)); template class __is_convertible_helper { template

[clang] Reapply "[Clang][Sema] Refactor collection of multi-level template argument lists (#106585, #111173)" (PR #111852)

2024-11-05 Thread Lei Wang via cfe-commits
wlei-llvm wrote: Hi @sdkrystian , FYI, we also hit an error/assertion that bisected to this https://github.com/llvm/llvm-project/pull/114569 ``` lvm-project/clang/lib/AST/ExprConstant.cpp:16601: bool clang::Expr::EvaluateAsConstantExpr(EvalResult &, const ASTContext &, ConstantExprKind) const

[clang] [llvm] [InstrPGO] Avoid using global variable to fix potential data race (PR #114364)

2024-10-31 Thread Lei Wang via cfe-commits
https://github.com/wlei-llvm closed https://github.com/llvm/llvm-project/pull/114364 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [InstrPGO] Avoid using global variable to fix potential data race (PR #114364)

2024-10-31 Thread Lei Wang via cfe-commits
https://github.com/wlei-llvm updated https://github.com/llvm/llvm-project/pull/114364 >From a7b444bd75d6f83ed0f5692783990a59f36e8459 Mon Sep 17 00:00:00 2001 From: wlei Date: Thu, 31 Oct 2024 09:58:27 -0700 Subject: [PATCH 1/4] Reapply "[InstrPGO] Support cold function coverage instrumentation

[clang] [llvm] [InstrPGO] Avoid using global variable to fix potential data race (PR #114364)

2024-10-31 Thread Lei Wang via cfe-commits
https://github.com/wlei-llvm updated https://github.com/llvm/llvm-project/pull/114364 >From a7b444bd75d6f83ed0f5692783990a59f36e8459 Mon Sep 17 00:00:00 2001 From: wlei Date: Thu, 31 Oct 2024 09:58:27 -0700 Subject: [PATCH 1/4] Reapply "[InstrPGO] Support cold function coverage instrumentation

[clang] [llvm] [InstrPGO] Avoid using global variable to fix potential data race (PR #114364)

2024-10-31 Thread Lei Wang via cfe-commits
https://github.com/wlei-llvm updated https://github.com/llvm/llvm-project/pull/114364 >From a7b444bd75d6f83ed0f5692783990a59f36e8459 Mon Sep 17 00:00:00 2001 From: wlei Date: Thu, 31 Oct 2024 09:58:27 -0700 Subject: [PATCH 1/3] Reapply "[InstrPGO] Support cold function coverage instrumentation

[clang] [llvm] [InstrPGO] Avoid using global variable to fix potential data race (PR #114364)

2024-10-31 Thread Lei Wang via cfe-commits
https://github.com/wlei-llvm updated https://github.com/llvm/llvm-project/pull/114364 >From a7b444bd75d6f83ed0f5692783990a59f36e8459 Mon Sep 17 00:00:00 2001 From: wlei Date: Thu, 31 Oct 2024 09:58:27 -0700 Subject: [PATCH 1/3] Reapply "[InstrPGO] Support cold function coverage instrumentation

[clang] [llvm] [InstrPGO] Support cold function coverage instrumentation (PR #109837)

2024-10-31 Thread Lei Wang via cfe-commits
@@ -1182,8 +1187,13 @@ PassBuilder::buildModuleSimplificationPipeline(OptimizationLevel Level, const bool IsCtxProfUse = !UseCtxProfile.empty() && Phase == ThinOrFullLTOPhase::ThinLTOPreLink; + // Enable cold function coverage instrumentation if + // InstrumentColdF

[clang] [llvm] [InstrPGO] Avoid using global variable to fix potential data race (PR #114364)

2024-10-31 Thread Lei Wang via cfe-commits
https://github.com/wlei-llvm ready_for_review https://github.com/llvm/llvm-project/pull/114364 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [InstrPGO] Avoid using global variable to fix potential data race (PR #114364)

2024-10-30 Thread Lei Wang via cfe-commits
https://github.com/wlei-llvm created https://github.com/llvm/llvm-project/pull/114364 In https://github.com/llvm/llvm-project/pull/109837, it sets a global variable(`PGOInstrumentColdFunctionOnly`) in PassBuilderPipelines.cpp which introduced a data race detected by TSan. To fix this, I decoup

[clang] [llvm] [InstrPGO] Support cold function coverage instrumentation (PR #109837)

2024-10-30 Thread Lei Wang via cfe-commits
@@ -1182,8 +1187,13 @@ PassBuilder::buildModuleSimplificationPipeline(OptimizationLevel Level, const bool IsCtxProfUse = !UseCtxProfile.empty() && Phase == ThinOrFullLTOPhase::ThinLTOPreLink; + // Enable cold function coverage instrumentation if + // InstrumentColdF

[clang] specify clang --target to fix breakage on AIX (PR #114127)

2024-10-29 Thread Lei Wang via cfe-commits
https://github.com/wlei-llvm closed https://github.com/llvm/llvm-project/pull/114127 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] specify clang --target to fix breakage on AIX (PR #114127)

2024-10-29 Thread Lei Wang via cfe-commits
https://github.com/wlei-llvm updated https://github.com/llvm/llvm-project/pull/114127 >From 2c2ddcc9bda277c6da7b51147785c0f1e88b848d Mon Sep 17 00:00:00 2001 From: wlei Date: Tue, 29 Oct 2024 13:28:33 -0700 Subject: [PATCH] specify clang --target to fix breakage on AIX --- clang/test/CodeGen/

[clang] specify clang --target to fix breakage on AIX (PR #114127)

2024-10-29 Thread Lei Wang via cfe-commits
https://github.com/wlei-llvm created https://github.com/llvm/llvm-project/pull/114127 `-fprofile-sample-use` is not supported on AIX, which caused a CI failure. >From 2c2ddcc9bda277c6da7b51147785c0f1e88b848d Mon Sep 17 00:00:00 2001 From: wlei Date: Tue, 29 Oct 2024 13:28:33 -0700 Subject: [PA

[clang] [llvm] [InstrPGO] Support cold function coverage instrumentation (PR #109837)

2024-10-29 Thread Lei Wang via cfe-commits
wlei-llvm wrote: > Hi, this PR is causing a regression on the AIX bot here > https://lab.llvm.org/buildbot/#/builders/64/builds/1321/steps/6/logs/FAIL__Clang__pgo-cold-function-coverage_c. > Would you be able to take a look? I think it can be resolved by using > clang_cc1 in the testcase of ma

[clang] [llvm] [InstrPGO] Instrument sampling profile based cold function v2 (PR #110330)

2024-10-28 Thread Lei Wang via cfe-commits
https://github.com/wlei-llvm closed https://github.com/llvm/llvm-project/pull/110330 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [InstrPGO] Support cold function coverage instrumentation (PR #109837)

2024-10-28 Thread Lei Wang via cfe-commits
https://github.com/wlei-llvm closed https://github.com/llvm/llvm-project/pull/109837 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [InstrPGO] Support cold function coverage instrumentation (PR #109837)

2024-10-28 Thread Lei Wang via cfe-commits
https://github.com/wlei-llvm edited https://github.com/llvm/llvm-project/pull/109837 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [InstrPGO] Instrument sampling profile based cold function (PR #109837)

2024-10-27 Thread Lei Wang via cfe-commits
https://github.com/wlei-llvm edited https://github.com/llvm/llvm-project/pull/109837 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [InstrPGO] Instrument sampling profile based cold function (PR #109837)

2024-10-27 Thread Lei Wang via cfe-commits
https://github.com/wlei-llvm updated https://github.com/llvm/llvm-project/pull/109837 >From 07a2cab3fa5df2965f9f7da9ee2d3603581a47f1 Mon Sep 17 00:00:00 2001 From: wlei Date: Sun, 22 Sep 2024 20:23:20 -0700 Subject: [PATCH 1/8] [InstrPGO] Instrument sampling profile based cold function --- c

[clang] [llvm] [InstrPGO] Instrument sampling profile based cold function (PR #109837)

2024-10-27 Thread Lei Wang via cfe-commits
https://github.com/wlei-llvm updated https://github.com/llvm/llvm-project/pull/109837 >From 07a2cab3fa5df2965f9f7da9ee2d3603581a47f1 Mon Sep 17 00:00:00 2001 From: wlei Date: Sun, 22 Sep 2024 20:23:20 -0700 Subject: [PATCH 1/8] [InstrPGO] Instrument sampling profile based cold function --- c

[clang] [llvm] [InstrPGO] Instrument sampling profile based cold function (PR #109837)

2024-10-21 Thread Lei Wang via cfe-commits
https://github.com/wlei-llvm updated https://github.com/llvm/llvm-project/pull/109837 >From 07a2cab3fa5df2965f9f7da9ee2d3603581a47f1 Mon Sep 17 00:00:00 2001 From: wlei Date: Sun, 22 Sep 2024 20:23:20 -0700 Subject: [PATCH 1/7] [InstrPGO] Instrument sampling profile based cold function --- c

[clang] [llvm] [InstrPGO] Instrument sampling profile based cold function (PR #109837)

2024-10-21 Thread Lei Wang via cfe-commits
@@ -649,6 +649,24 @@ static void addPGOAndCoverageFlags(const ToolChain &TC, Compilation &C, } } + if (auto *ColdFuncCoverageArg = Args.getLastArg( + options::OPT_fprofile_generate_cold_function_coverage, + options::OPT_fprofile_generate_cold_function

[clang] [llvm] [InstrPGO] Instrument sampling profile based cold function (PR #109837)

2024-10-21 Thread Lei Wang via cfe-commits
@@ -319,6 +319,29 @@ static cl::opt PGOFunctionCriticalEdgeThreshold( cl::desc("Do not instrument functions with the number of critical edges " " greater than this threshold.")); +static cl::opt ColdFuncCoverageMaxEntryCount( +"cold-function-coverage-max-e

[clang] [llvm] [InstrPGO] Instrument sampling profile based cold function (PR #109837)

2024-10-21 Thread Lei Wang via cfe-commits
@@ -1784,6 +1784,12 @@ defm debug_info_for_profiling : BoolFOption<"debug-info-for-profiling", PosFlag, NegFlag>; +def fprofile_generate_cold_function_coverage : Flag<["-"], "fprofile-generate-cold-function-coverage">, +Group, Visibility<[ClangOption, CLOption]>, +

[clang] [llvm] [InstrPGO] Instrument sampling profile based cold function (PR #109837)

2024-10-09 Thread Lei Wang via cfe-commits
https://github.com/wlei-llvm updated https://github.com/llvm/llvm-project/pull/109837 >From 07a2cab3fa5df2965f9f7da9ee2d3603581a47f1 Mon Sep 17 00:00:00 2001 From: wlei Date: Sun, 22 Sep 2024 20:23:20 -0700 Subject: [PATCH 1/6] [InstrPGO] Instrument sampling profile based cold function --- c

[clang] [llvm] [InstrPGO] Instrument sampling profile based cold function (PR #109837)

2024-10-08 Thread Lei Wang via cfe-commits
https://github.com/wlei-llvm updated https://github.com/llvm/llvm-project/pull/109837 >From 07a2cab3fa5df2965f9f7da9ee2d3603581a47f1 Mon Sep 17 00:00:00 2001 From: wlei Date: Sun, 22 Sep 2024 20:23:20 -0700 Subject: [PATCH 1/5] [InstrPGO] Instrument sampling profile based cold function --- c

[clang] [llvm] [InstrPGO] Instrument sampling profile based cold function (PR #109837)

2024-10-08 Thread Lei Wang via cfe-commits
@@ -1119,6 +1125,18 @@ PassBuilder::buildModuleSimplificationPipeline(OptimizationLevel Level, // removed. MPM.addPass( PGOIndirectCallPromotion(true /* IsInLTO */, true /* SamplePGO */)); + +if (InstrumentSampleColdFuncPath.getNumOccurrences() && +

[clang] [llvm] [InstrPGO] Instrument sampling profile based cold function (PR #109837)

2024-10-08 Thread Lei Wang via cfe-commits
https://github.com/wlei-llvm updated https://github.com/llvm/llvm-project/pull/109837 >From 07a2cab3fa5df2965f9f7da9ee2d3603581a47f1 Mon Sep 17 00:00:00 2001 From: wlei Date: Sun, 22 Sep 2024 20:23:20 -0700 Subject: [PATCH 1/4] [InstrPGO] Instrument sampling profile based cold function --- c

[clang] [llvm] [InstrPGO] Instrument sampling profile based cold function (PR #109837)

2024-10-08 Thread Lei Wang via cfe-commits
@@ -1119,6 +1125,18 @@ PassBuilder::buildModuleSimplificationPipeline(OptimizationLevel Level, // removed. MPM.addPass( PGOIndirectCallPromotion(true /* IsInLTO */, true /* SamplePGO */)); + +if (InstrumentSampleColdFuncPath.getNumOccurrences() && +

[clang] [llvm] [InstrPGO] Instrument sampling profile based cold function (PR #109837)

2024-10-02 Thread Lei Wang via cfe-commits
@@ -1119,6 +1125,18 @@ PassBuilder::buildModuleSimplificationPipeline(OptimizationLevel Level, // removed. MPM.addPass( PGOIndirectCallPromotion(true /* IsInLTO */, true /* SamplePGO */)); + +if (InstrumentSampleColdFuncPath.getNumOccurrences() && +

[clang] [llvm] [InstrPGO] Instrument sampling profile based cold function (PR #109837)

2024-10-02 Thread Lei Wang via cfe-commits
https://github.com/wlei-llvm updated https://github.com/llvm/llvm-project/pull/109837 >From 07a2cab3fa5df2965f9f7da9ee2d3603581a47f1 Mon Sep 17 00:00:00 2001 From: wlei Date: Sun, 22 Sep 2024 20:23:20 -0700 Subject: [PATCH 1/3] [InstrPGO] Instrument sampling profile based cold function --- c

[clang] [llvm] [InstrPGO] Instrument sampling profile based cold function (PR #109837)

2024-10-02 Thread Lei Wang via cfe-commits
@@ -0,0 +1,24 @@ +; RUN: opt < %s --passes=pgo-instr-gen -instrument-cold-function-coverage -S | FileCheck --check-prefixes=COLD %s +; RUN: opt < %s --passes=pgo-instr-gen -instrument-cold-function-coverage -cold-function-coverage-max-entry-count=1 -S | FileCheck --check-pr

[clang] [llvm] [InstrPGO] Instrument sampling profile based cold function (PR #109837)

2024-10-02 Thread Lei Wang via cfe-commits
@@ -1119,6 +1125,18 @@ PassBuilder::buildModuleSimplificationPipeline(OptimizationLevel Level, // removed. MPM.addPass( PGOIndirectCallPromotion(true /* IsInLTO */, true /* SamplePGO */)); + +if (InstrumentSampleColdFuncPath.getNumOccurrences() && +

[clang] [llvm] [InstrPGO] Instrument sampling profile based cold function (PR #109837)

2024-10-02 Thread Lei Wang via cfe-commits
@@ -1784,6 +1784,12 @@ defm debug_info_for_profiling : BoolFOption<"debug-info-for-profiling", PosFlag, NegFlag>; +def fprofile_generate_cold_function_coverage : Flag<["-"], "fprofile-generate-cold-function-coverage">, wlei-llvm wrote: >Would -Wl,-lclang

[clang] [llvm] [InstrPGO] Instrument sampling profile based cold function (PR #109837)

2024-10-02 Thread Lei Wang via cfe-commits
@@ -1784,6 +1784,12 @@ defm debug_info_for_profiling : BoolFOption<"debug-info-for-profiling", PosFlag, NegFlag>; +def fprofile_generate_cold_function_coverage : Flag<["-"], "fprofile-generate-cold-function-coverage">, wlei-llvm wrote: > I meant, why not

[clang] [llvm] [InstrPGO] Instrument sampling profile based cold function (PR #109837)

2024-10-01 Thread Lei Wang via cfe-commits
https://github.com/wlei-llvm edited https://github.com/llvm/llvm-project/pull/109837 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [InstrPGO] Instrument sampling profile based cold function (PR #109837)

2024-10-01 Thread Lei Wang via cfe-commits
https://github.com/wlei-llvm updated https://github.com/llvm/llvm-project/pull/109837 >From 07a2cab3fa5df2965f9f7da9ee2d3603581a47f1 Mon Sep 17 00:00:00 2001 From: wlei Date: Sun, 22 Sep 2024 20:23:20 -0700 Subject: [PATCH 1/2] [InstrPGO] Instrument sampling profile based cold function --- c

[clang] [llvm] [InstrPGO] Instrument sampling profile based cold function (PR #109837)

2024-10-01 Thread Lei Wang via cfe-commits
wlei-llvm wrote: Thanks for the context! > Why not use the existing `-pgo-function-entry-coverage` > (https://discourse.llvm.org/t/instrprofiling-lightweight-instrumentation/59113/14?u=ellishg) > LLVM flag? It takes advantage of the `llvm.instrprof.cover` intrinsic which > has less size and r

[clang] [llvm] [InstrPGO] Instrument sampling profile based cold function (PR #109837)

2024-10-01 Thread Lei Wang via cfe-commits
wlei-llvm wrote: > For your use case, can you use > [ProfileSymbolList](https://github.com/llvm/llvm-project/blob/32ffc9fdc2cd422c88c926b862adb3de726e3888/llvm/include/llvm/ProfileData/SampleProf.h#L1509-L1512) > to identify very cold functions (executed but unsampled) or are you indeed > look

[clang] [llvm] [InstrPGO] Instrument sampling profile based cold function (PR #109837)

2024-10-01 Thread Lei Wang via cfe-commits
@@ -1784,6 +1784,12 @@ defm debug_info_for_profiling : BoolFOption<"debug-info-for-profiling", PosFlag, NegFlag>; +def fprofile_generate_cold_function_coverage : Flag<["-"], "fprofile-generate-cold-function-coverage">, wlei-llvm wrote: Sorry if my PR des

[clang] [llvm] [InstrPGO] Instrument sampling profile based cold function (PR #109837)

2024-10-01 Thread Lei Wang via cfe-commits
https://github.com/wlei-llvm ready_for_review https://github.com/llvm/llvm-project/pull/109837 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [InstrPGO] Instrument sampling profile based cold function (PR #109837)

2024-09-30 Thread Lei Wang via cfe-commits
https://github.com/wlei-llvm updated https://github.com/llvm/llvm-project/pull/109837 >From 07a2cab3fa5df2965f9f7da9ee2d3603581a47f1 Mon Sep 17 00:00:00 2001 From: wlei Date: Sun, 22 Sep 2024 20:23:20 -0700 Subject: [PATCH] [InstrPGO] Instrument sampling profile based cold function --- clang/

[clang] [llvm] [InstrPGO] Instrument sampling profile based cold function (PR #109837)

2024-09-30 Thread Lei Wang via cfe-commits
https://github.com/wlei-llvm edited https://github.com/llvm/llvm-project/pull/109837 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [InstrPGO] Instrument sampling profile based cold function (PR #109837)

2024-09-29 Thread Lei Wang via cfe-commits
https://github.com/wlei-llvm edited https://github.com/llvm/llvm-project/pull/109837 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [InstrPGO] Instrument sampling profile based cold function (PR #109837)

2024-09-27 Thread Lei Wang via cfe-commits
https://github.com/wlei-llvm edited https://github.com/llvm/llvm-project/pull/109837 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [InstrPGO] Instrument sampling profile based cold function (PR #110330)

2024-09-27 Thread Lei Wang via cfe-commits
https://github.com/wlei-llvm created https://github.com/llvm/llvm-project/pull/110330 None >From d660d3b9a043a3530a735c1b95790116f6366062 Mon Sep 17 00:00:00 2001 From: wlei Date: Sun, 22 Sep 2024 20:23:20 -0700 Subject: [PATCH 1/2] [InstrPGO] Instrument sampling profile based cold function

[clang] [llvm] [InstrPGO] Instrument sampling profile based cold function v2 (PR #110330)

2024-09-27 Thread Lei Wang via cfe-commits
https://github.com/wlei-llvm edited https://github.com/llvm/llvm-project/pull/110330 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [InstrPGO] Instrument sampling profile based cold function v2 (PR #110330)

2024-09-27 Thread Lei Wang via cfe-commits
https://github.com/wlei-llvm edited https://github.com/llvm/llvm-project/pull/110330 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [InstrPGO] Instrument sampling profile based cold function (PR #109837)

2024-09-27 Thread Lei Wang via cfe-commits
https://github.com/wlei-llvm updated https://github.com/llvm/llvm-project/pull/109837 >From 436ab3bfb3d7f1978ba1598ec7d3ca006706cbd3 Mon Sep 17 00:00:00 2001 From: wlei Date: Sun, 22 Sep 2024 20:23:20 -0700 Subject: [PATCH] [InstrPGO] Instrument sampling profile based cold function --- clang/

[clang] [llvm] [InstrPGO] Instrument sampling profile based cold function (PR #109837)

2024-09-27 Thread Lei Wang via cfe-commits
https://github.com/wlei-llvm updated https://github.com/llvm/llvm-project/pull/109837 >From 36a747b5ef2123dd10909b91ad963e30af63b3b8 Mon Sep 17 00:00:00 2001 From: wlei Date: Sun, 22 Sep 2024 20:23:20 -0700 Subject: [PATCH] [InstrPGO] Instrument sampling profile based cold function --- clang/

[clang] [llvm] [InstrPGO] Instrument sampling profile based cold function (PR #109837)

2024-09-27 Thread Lei Wang via cfe-commits
https://github.com/wlei-llvm updated https://github.com/llvm/llvm-project/pull/109837 >From 6a9b51130269975b5832a5439897dcb34b9dc942 Mon Sep 17 00:00:00 2001 From: wlei Date: Sun, 22 Sep 2024 20:23:20 -0700 Subject: [PATCH] [InstrPGO] Instrument sampling profile based cold function --- clang/

[clang] [llvm] [InstrPGO] Instrument sampling profile based cold function (PR #109837)

2024-09-27 Thread Lei Wang via cfe-commits
https://github.com/wlei-llvm edited https://github.com/llvm/llvm-project/pull/109837 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [InstrPGO] Instrument sampling profile based cold function (PR #109837)

2024-09-24 Thread Lei Wang via cfe-commits
https://github.com/wlei-llvm created https://github.com/llvm/llvm-project/pull/109837 None >From b693ff3c33dcf21c1343d9d3432b1d7410a8b579 Mon Sep 17 00:00:00 2001 From: wlei Date: Sun, 22 Sep 2024 20:23:20 -0700 Subject: [PATCH] [InstrPGO] Instrument sampling profile based cold function ---

[clang] [Clang][Sema] Fix crash when using name of UnresolvedUsingValueDecl with template arguments (PR #83842)

2024-03-09 Thread Lei Wang via cfe-commits
wlei-llvm wrote: ``` clang++ -std=gnu++20 test.cpp clang-18: /../llvm-project/llvm/include/llvm/Support/Casting.h:578: decltype(auto) llvm::cast(From *) [To = clang::CXXRecordDecl, From = clang::DeclContext]: Assertion `isa(Val) && "cast() argument of incompatible type!"' failed. PLEASE subm

[clang] [Clang][Sema] Fix crash when using name of UnresolvedUsingValueDecl with template arguments (PR #83842)

2024-03-09 Thread Lei Wang via cfe-commits
wlei-llvm wrote: Here is the repro from our side. It's reduced by creduce, there are some unrelated error, the assertion is the real issue. ``` typedef a; template < typename b, b c > struct d { static constexpr b e = c; }; typedef d< bool, true > f; typedef d< bool, false > g; template < bo

[clang] [Clang][Sema] Fix crash when using name of UnresolvedUsingValueDecl with template arguments (PR #83842)

2024-03-07 Thread Lei Wang via cfe-commits
wlei-llvm wrote: Hi: We hit a crash/assertion, and bisected to this. Here is the stack dump: ``` clang++: /home/wlei/local/upstream/llvm-project/llvm/include/llvm/Support/Casting.h:578: decltype(auto) llvm::cast(From *) [To = clang::CXXRecordDecl, From = clang::DeclContext]: Assertion `isa(Va

[clang] [llvm] [PseudoProbe] Mix and reorder block and call probe ID in lexical order (PR #75092)

2024-02-29 Thread Lei Wang via cfe-commits
https://github.com/wlei-llvm updated https://github.com/llvm/llvm-project/pull/75092 >From e6f735a336f87659ee3236fc795ad4b7107dff4d Mon Sep 17 00:00:00 2001 From: wlei Date: Sun, 10 Dec 2023 18:30:42 -0800 Subject: [PATCH 1/5] [PseudoProbe] Mix and reorder block and call probe ID in lexical or

[clang] [llvm] [PseudoProbe] Mix and reorder block and call probe ID in lexical order (PR #75092)

2024-02-29 Thread Lei Wang via cfe-commits
wlei-llvm wrote: > > > LGTM. I'd also have a change that errors out on huge staleness go in > > > together with this one.. > > > > > > Was thinking to use a separate diff for that, feels non-trivial to do it, > > but I'm also good for doing in this. > > Just pushed one version for this, it us

[clang] [llvm] [PseudoProbe] Mix and reorder block and call probe ID in lexical order (PR #75092)

2024-02-29 Thread Lei Wang via cfe-commits
wlei-llvm wrote: > LGTM. I'd also have a change that errors out on huge staleness go in together > with this one.. Was thinking to use a separate diff for that, feels non-trivial to do it, but I'm also good for doing in this. Just pushed one version for this, it use heuristics to check this

[clang] [llvm] [PseudoProbe] Mix and reorder block and call probe ID in lexical order (PR #75092)

2024-02-29 Thread Lei Wang via cfe-commits
https://github.com/wlei-llvm updated https://github.com/llvm/llvm-project/pull/75092 >From e6f735a336f87659ee3236fc795ad4b7107dff4d Mon Sep 17 00:00:00 2001 From: wlei Date: Sun, 10 Dec 2023 18:30:42 -0800 Subject: [PATCH 1/4] [PseudoProbe] Mix and reorder block and call probe ID in lexical or

[clang] [llvm] [PseudoProbe] Mix and reorder block and call probe ID in lexical order (PR #75092)

2024-02-28 Thread Lei Wang via cfe-commits
wlei-llvm wrote: As discussed offline, reverted the complicated order detection change. https://github.com/llvm/llvm-project/pull/75092 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [PseudoProbe] Mix and reorder block and call probe ID in lexical order (PR #75092)

2024-02-28 Thread Lei Wang via cfe-commits
https://github.com/wlei-llvm updated https://github.com/llvm/llvm-project/pull/75092 >From ccfee2d0c5399b03b53ef79a4645ab0d10efeafd Mon Sep 17 00:00:00 2001 From: wlei Date: Sun, 10 Dec 2023 18:30:42 -0800 Subject: [PATCH 1/3] [PseudoProbe] Mix and reorder block and call probe ID in lexical or

[llvm] [clang] [libcxx] [libc] [compiler-rt] [lld] [libcxxabi] [flang] [clang-tools-extra] [CSSPGO] Compute and report post-match profile staleness (PR #79090)

2024-01-29 Thread Lei Wang via cfe-commits
@@ -2460,63 +2528,108 @@ void SampleProfileMatcher::runOnFunction(const Function &F) { !ProbeManager->profileIsValid(F, *FSFlattened)) { // The matching result will be saved to IRToProfileLocationMap, create a new // map for each function. +auto &IRToProfile

[libc] [lld] [flang] [libcxxabi] [compiler-rt] [libcxx] [clang-tools-extra] [llvm] [clang] [CSSPGO] Compute and report post-match profile staleness (PR #79090)

2024-01-29 Thread Lei Wang via cfe-commits
@@ -2460,63 +2528,108 @@ void SampleProfileMatcher::runOnFunction(const Function &F) { !ProbeManager->profileIsValid(F, *FSFlattened)) { // The matching result will be saved to IRToProfileLocationMap, create a new // map for each function. +auto &IRToProfile

[libc] [libcxx] [libcxxabi] [clang-tools-extra] [llvm] [compiler-rt] [lld] [clang] [flang] [CSSPGO] Compute and report post-match profile staleness (PR #79090)

2024-01-29 Thread Lei Wang via cfe-commits
@@ -433,6 +433,44 @@ using CandidateQueue = PriorityQueue, CandidateComparer>; +// Profile matching statstics. +class ProfileMatchStats { wlei-llvm wrote: I was thinking that too until I worked with this `StringMap> FuncMismatchedCallsi

[flang] [lld] [llvm] [clang] [libcxxabi] [libc] [libcxx] [clang-tools-extra] [compiler-rt] [CSSPGO] Compute and report post-match profile staleness (PR #79090)

2024-01-29 Thread Lei Wang via cfe-commits
@@ -433,6 +433,44 @@ using CandidateQueue = PriorityQueue, CandidateComparer>; +// Profile matching statstics. +class ProfileMatchStats { + const Module &M; + SampleProfileReader &Reader; + const PseudoProbeManager *ProbeManager; + +public: + ProfileM

[libcxx] [llvm] [lld] [libc] [flang] [compiler-rt] [libcxxabi] [clang] [clang-tools-extra] [CSSPGO] Compute and report post-match profile staleness (PR #79090)

2024-01-29 Thread Lei Wang via cfe-commits
@@ -2205,93 +2230,141 @@ void SampleProfileMatcher::countMismatchedSamples(const FunctionSamples &FS) { countMismatchedSamples(CS.second); } -void SampleProfileMatcher::countProfileMismatches( -const Function &F, const FunctionSamples &FS, -const std::map &IRAnc

[libc] [lld] [libcxx] [libcxxabi] [compiler-rt] [llvm] [clang] [flang] [clang-tools-extra] [CSSPGO] Compute and report post-match profile staleness (PR #79090)

2024-01-26 Thread Lei Wang via cfe-commits
https://github.com/wlei-llvm updated https://github.com/llvm/llvm-project/pull/79090 >From 54784e26f33178efd21b0289a1f673d66ea26cc3 Mon Sep 17 00:00:00 2001 From: wlei Date: Mon, 22 Jan 2024 19:16:26 -0800 Subject: [PATCH 1/3] [CSSPGO] Support post-match profile staleness metrics --- llvm/lib

[llvm] [clang] [PseudoProbe] Mix and reorder block and call probe ID in lexical order (PR #75092)

2024-01-25 Thread Lei Wang via cfe-commits
@@ -471,6 +471,66 @@ ProfileGenerator::getTopLevelFunctionProfile(FunctionId FuncName) { return ProfileMap.Create(Context); } +// Use a heuristic to determine probe order by checking callsite insertion +// position relative to the BB probes. Sort all the BB probes is in a l

[flang] [llvm] [compiler-rt] [libcxx] [libcxxabi] [libc] [clang-tools-extra] [lld] [clang] [CSSPGO] Compute and report post-match profile staleness (PR #79090)

2024-01-25 Thread Lei Wang via cfe-commits
@@ -2422,59 +2342,226 @@ void SampleProfileMatcher::runStaleProfileMatching( } } -void SampleProfileMatcher::runOnFunction(const Function &F) { - // We need to use flattened function samples for matching. - // Unlike IR, which includes all callsites from the source code, t

[llvm] [clang] [PseudoProbe] Mix and reorder block and call probe ID in lexical order (PR #75092)

2024-01-24 Thread Lei Wang via cfe-commits
@@ -471,6 +471,66 @@ ProfileGenerator::getTopLevelFunctionProfile(FunctionId FuncName) { return ProfileMap.Create(Context); } +// Use a heuristic to determine probe order by checking callsite insertion +// position relative to the BB probes. Sort all the BB probes is in a l

[clang] [llvm] [PseudoProbe] Mix and reorder block and call probe ID in lexical order (PR #75092)

2024-01-24 Thread Lei Wang via cfe-commits
@@ -471,6 +471,66 @@ ProfileGenerator::getTopLevelFunctionProfile(FunctionId FuncName) { return ProfileMap.Create(Context); } +// Use a heuristic to determine probe order by checking callsite insertion +// position relative to the BB probes. Sort all the BB probes is in a l

[clang] [llvm] [PseudoProbe] Mix and reorder block and call probe ID in lexical order (PR #75092)

2024-01-24 Thread Lei Wang via cfe-commits
https://github.com/wlei-llvm commented: Thanks for the feedback, it's indeed complicated (even than I expected..) https://github.com/llvm/llvm-project/pull/75092 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mai

[llvm] [clang] [PseudoProbe] Mix and reorder block and call probe ID in lexical order (PR #75092)

2024-01-24 Thread Lei Wang via cfe-commits
https://github.com/wlei-llvm edited https://github.com/llvm/llvm-project/pull/75092 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[libcxx] [compiler-rt] [lld] [libc] [llvm] [flang] [clang-tools-extra] [clang] [libcxxabi] [CSSPGO] Compute and report post-match profile staleness (PR #79090)

2024-01-24 Thread Lei Wang via cfe-commits
https://github.com/wlei-llvm edited https://github.com/llvm/llvm-project/pull/79090 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[lld] [clang] [clang-tools-extra] [compiler-rt] [libcxxabi] [flang] [llvm] [libc] [libcxx] [CSSPGO] Compute and report post-match profile staleness (PR #79090)

2024-01-24 Thread Lei Wang via cfe-commits
wlei-llvm wrote: Thanks so much for the feedback. Answering some high-level questions, will address others later. https://github.com/llvm/llvm-project/pull/79090 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/ma

[libc] [llvm] [clang-tools-extra] [libcxxabi] [flang] [lld] [compiler-rt] [clang] [libcxx] [CSSPGO] Compute and report post-match profile staleness (PR #79090)

2024-01-24 Thread Lei Wang via cfe-commits
@@ -2422,59 +2342,226 @@ void SampleProfileMatcher::runStaleProfileMatching( } } -void SampleProfileMatcher::runOnFunction(const Function &F) { - // We need to use flattened function samples for matching. - // Unlike IR, which includes all callsites from the source code, t

[libc] [llvm] [clang-tools-extra] [libcxxabi] [flang] [lld] [compiler-rt] [clang] [libcxx] [CSSPGO] Compute and report post-match profile staleness (PR #79090)

2024-01-24 Thread Lei Wang via cfe-commits
@@ -2422,59 +2342,226 @@ void SampleProfileMatcher::runStaleProfileMatching( } } -void SampleProfileMatcher::runOnFunction(const Function &F) { - // We need to use flattened function samples for matching. - // Unlike IR, which includes all callsites from the source code, t

[libc] [llvm] [clang-tools-extra] [libcxxabi] [flang] [lld] [compiler-rt] [clang] [libcxx] [CSSPGO] Compute and report post-match profile staleness (PR #79090)

2024-01-24 Thread Lei Wang via cfe-commits
@@ -2422,59 +2342,226 @@ void SampleProfileMatcher::runStaleProfileMatching( } } -void SampleProfileMatcher::runOnFunction(const Function &F) { - // We need to use flattened function samples for matching. - // Unlike IR, which includes all callsites from the source code, t

[flang] [libcxx] [libcxxabi] [libc] [llvm] [clang] [compiler-rt] [clang-tools-extra] [lld] [CSSPGO] Compute and report post-match profile staleness (PR #79090)

2024-01-23 Thread Lei Wang via cfe-commits
https://github.com/wlei-llvm updated https://github.com/llvm/llvm-project/pull/79090 >From 54784e26f33178efd21b0289a1f673d66ea26cc3 Mon Sep 17 00:00:00 2001 From: wlei Date: Mon, 22 Jan 2024 19:16:26 -0800 Subject: [PATCH] [CSSPGO] Support post-match profile staleness metrics --- llvm/lib/Tra

[clang] [llvm] [PseudoProbe] Mix and reorder block and call probe ID in lexical order (PR #75092)

2024-01-10 Thread Lei Wang via cfe-commits
wlei-llvm wrote: > > Agreed with this concern. To do this, we probably also need a flag in the > > binary, because otherwise if we use the new toolchain for prof-gen but the > > binary built on the old toolchain, we then would generate a profile with > > this flag on but the order is the old o

[clang] [llvm] [PseudoProbe] Mix and reorder block and call probe ID in lexical order (PR #75092)

2024-01-10 Thread Lei Wang via cfe-commits
https://github.com/wlei-llvm updated https://github.com/llvm/llvm-project/pull/75092 >From ccfee2d0c5399b03b53ef79a4645ab0d10efeafd Mon Sep 17 00:00:00 2001 From: wlei Date: Sun, 10 Dec 2023 18:30:42 -0800 Subject: [PATCH 1/2] [PseudoProbe] Mix and reorder block and call probe ID in lexical or

[llvm] [clang] [PseudoProbe] Mix and reorder block and call probe ID in lexical order (PR #75092)

2024-01-04 Thread Lei Wang via cfe-commits
wlei-llvm wrote: > We will need some protection against accidentally consuming old profile with > new toolchain and vice versa. The cost of investigating mysterious perf > regression can be high and we'd rather simply error out in those cases. Maybe > consider some flag for `SecProfSummaryFlag

[clang] [llvm] [PseudoProbe] Mix and reorder block and call probe ID in lexical order (PR #75092)

2023-12-11 Thread Lei Wang via cfe-commits
https://github.com/wlei-llvm updated https://github.com/llvm/llvm-project/pull/75092 >From fe05f64f7ae0decc17d98bb694bbade178df7a4b Mon Sep 17 00:00:00 2001 From: wlei Date: Sun, 10 Dec 2023 18:30:42 -0800 Subject: [PATCH] [PseudoProbe] Mix and reorder block and call probe ID in lexical order

[clang] [llvm] [PseudoProbe] Mix and reorder block and call probe ID in lexical order (PR #75092)

2023-12-11 Thread Lei Wang via cfe-commits
https://github.com/wlei-llvm created https://github.com/llvm/llvm-project/pull/75092 Before all the call probe ids are after block ids, in this change, it mixed the call probe and block probe by reordering them in lexical(line-number) order. For example: ``` main(): BB1 if(...) BB2 foo(..)