[clang] [analyzer] Introduce per-entry-point statistics (PR #131175)

2025-03-17 Thread Arseniy Zaostrovnykh via cfe-commits
@@ -0,0 +1,201 @@ +//===- EntryPointStats.cpp --*- 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: Ap

[clang] [analyzer] Introduce per-entry-point statistics (PR #131175)

2025-03-17 Thread Arseniy Zaostrovnykh via cfe-commits
@@ -0,0 +1,201 @@ +//===- EntryPointStats.cpp --*- 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: Ap

[clang] [analyzer] Introduce per-entry-point statistics (PR #131175)

2025-03-15 Thread Arseniy Zaostrovnykh via cfe-commits
https://github.com/necto updated https://github.com/llvm/llvm-project/pull/131175 >From 6b6d80d42d40d5917622cbc2bc0f2a454c34eca3 Mon Sep 17 00:00:00 2001 From: Arseniy Zaostrovnykh Date: Thu, 13 Mar 2025 18:42:39 +0100 Subject: [PATCH 1/8] [analyzer] Introduce per-entry-point statistics MIME-Ve

[clang] [analyzer] Introduce per-entry-point statistics (PR #131175)

2025-03-15 Thread Arseniy Zaostrovnykh via cfe-commits
https://github.com/necto updated https://github.com/llvm/llvm-project/pull/131175 >From 6b6d80d42d40d5917622cbc2bc0f2a454c34eca3 Mon Sep 17 00:00:00 2001 From: Arseniy Zaostrovnykh Date: Thu, 13 Mar 2025 18:42:39 +0100 Subject: [PATCH 1/3] [analyzer] Introduce per-entry-point statistics MIME-Ve

[clang] [analyzer] Introduce per-entry-point statistics (PR #131175)

2025-03-15 Thread Arseniy Zaostrovnykh via cfe-commits
https://github.com/necto updated https://github.com/llvm/llvm-project/pull/131175 >From 6b6d80d42d40d5917622cbc2bc0f2a454c34eca3 Mon Sep 17 00:00:00 2001 From: Arseniy Zaostrovnykh Date: Thu, 13 Mar 2025 18:42:39 +0100 Subject: [PATCH 01/10] [analyzer] Introduce per-entry-point statistics MIME-

[clang] [analyzer] Introduce per-entry-point statistics (PR #131175)

2025-03-15 Thread Arseniy Zaostrovnykh via cfe-commits
@@ -688,6 +695,36 @@ AnalysisConsumer::getModeForDecl(Decl *D, AnalysisMode Mode) { return Mode; } +template +static clang::Decl *preferDefinitionImpl(clang::Decl *D) { + if (auto *X = dyn_cast(D)) +if (auto *Def = X->getDefinition()) + return Def; + return D; +

[clang] [analyzer] Introduce per-entry-point statistics (PR #131175)

2025-03-15 Thread Arseniy Zaostrovnykh via cfe-commits
https://github.com/necto updated https://github.com/llvm/llvm-project/pull/131175 >From 6b6d80d42d40d5917622cbc2bc0f2a454c34eca3 Mon Sep 17 00:00:00 2001 From: Arseniy Zaostrovnykh Date: Thu, 13 Mar 2025 18:42:39 +0100 Subject: [PATCH 01/11] [analyzer] Introduce per-entry-point statistics MIME-

[clang] [analyzer] Introduce per-entry-point statistics (PR #131175)

2025-03-15 Thread Arseniy Zaostrovnykh via cfe-commits
@@ -0,0 +1,33 @@ +=== +Analysis Statistics +=== + +CSA enjoys two facilities to collect statistics: per translation unit and per entry point. necto wrote: Expanded to be on the safe side 548eaadabf32 Expand acronym https://githu

[clang] [analyzer] Introduce per-entry-point statistics (PR #131175)

2025-03-15 Thread Arseniy Zaostrovnykh via cfe-commits
@@ -0,0 +1,201 @@ +//===- EntryPointStats.cpp --*- 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: Ap

[clang] [analyzer] Introduce per-entry-point statistics (PR #131175)

2025-03-15 Thread Arseniy Zaostrovnykh via cfe-commits
https://github.com/necto updated https://github.com/llvm/llvm-project/pull/131175 >From 6b6d80d42d40d5917622cbc2bc0f2a454c34eca3 Mon Sep 17 00:00:00 2001 From: Arseniy Zaostrovnykh Date: Thu, 13 Mar 2025 18:42:39 +0100 Subject: [PATCH 01/15] [analyzer] Introduce per-entry-point statistics MIME-

[clang] [analyzer] Introduce per-entry-point statistics (PR #131175)

2025-03-15 Thread Arseniy Zaostrovnykh via cfe-commits
https://github.com/necto edited https://github.com/llvm/llvm-project/pull/131175 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Introduce per-entry-point statistics (PR #131175)

2025-03-14 Thread Arseniy Zaostrovnykh via cfe-commits
https://github.com/necto edited https://github.com/llvm/llvm-project/pull/131175 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Introduce per-entry-point statistics (PR #131175)

2025-03-14 Thread Arseniy Zaostrovnykh via cfe-commits
@@ -0,0 +1,162 @@ +// EntryPointStats.h - Tracking statistics per entry point --*- C++ -*-// necto wrote: Fixed a93cac41b87d [NFC] Fix header comment widths https://github.com/llvm/llvm-project/pull/131175 ___ cfe-com

[clang] [analyzer] Introduce per-entry-point statistics (PR #131175)

2025-03-14 Thread Arseniy Zaostrovnykh via cfe-commits
@@ -0,0 +1,27 @@ +=== +Analysis Statistics +=== + +CSA enjoys two facilities to collect statistics: per translation unit and per entry point. +We use llvm/ADT/Statistic.h for numbers describing the entire translation unit (TU). +We use clang/Stati

[clang] [analyzer] Introduce per-entry-point statistics (PR #131175)

2025-03-14 Thread Arseniy Zaostrovnykh via cfe-commits
https://github.com/necto updated https://github.com/llvm/llvm-project/pull/131175 >From 6b6d80d42d40d5917622cbc2bc0f2a454c34eca3 Mon Sep 17 00:00:00 2001 From: Arseniy Zaostrovnykh Date: Thu, 13 Mar 2025 18:42:39 +0100 Subject: [PATCH 01/13] [analyzer] Introduce per-entry-point statistics MIME-

[clang] [analyzer] Introduce per-entry-point statistics (PR #131175)

2025-03-14 Thread Arseniy Zaostrovnykh via cfe-commits
https://github.com/necto updated https://github.com/llvm/llvm-project/pull/131175 >From 6b6d80d42d40d5917622cbc2bc0f2a454c34eca3 Mon Sep 17 00:00:00 2001 From: Arseniy Zaostrovnykh Date: Thu, 13 Mar 2025 18:42:39 +0100 Subject: [PATCH 01/12] [analyzer] Introduce per-entry-point statistics MIME-

[clang] [analyzer] Introduce per-entry-point statistics (PR #131175)

2025-03-14 Thread Arseniy Zaostrovnykh via cfe-commits
https://github.com/necto updated https://github.com/llvm/llvm-project/pull/131175 >From 6b6d80d42d40d5917622cbc2bc0f2a454c34eca3 Mon Sep 17 00:00:00 2001 From: Arseniy Zaostrovnykh Date: Thu, 13 Mar 2025 18:42:39 +0100 Subject: [PATCH 1/9] [analyzer] Introduce per-entry-point statistics MIME-Ve

[clang] [analyzer] Introduce per-entry-point statistics (PR #131175)

2025-03-14 Thread Arseniy Zaostrovnykh via cfe-commits
@@ -0,0 +1,201 @@ +//===- EntryPointStats.cpp --===// +// +// 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: Apach

[clang] [analyzer] Introduce per-entry-point statistics (PR #131175)

2025-03-14 Thread Arseniy Zaostrovnykh via cfe-commits
@@ -353,6 +353,12 @@ ANALYZER_OPTION(bool, DisplayCTUProgress, "display-ctu-progress", "the analyzer's progress related to ctu.", false) +ANALYZER_OPTION( +StringRef, DumpSEStatsToCSV, "dump-se-stats-to-csv", necto wrote:

[clang] [analyzer] Introduce per-entry-point statistics (PR #131175)

2025-03-14 Thread Arseniy Zaostrovnykh via cfe-commits
@@ -0,0 +1,27 @@ +=== +Analysis Statistics +=== + +CSA enjoys two facilities to collect statistics: per translation unit and per entry point. +We use llvm/ADT/Statistic.h for numbers describing the entire translation unit (TU). +We use clang/Stati

[clang] [analyzer] Introduce per-entry-point statistics (PR #131175)

2025-03-14 Thread Arseniy Zaostrovnykh via cfe-commits
@@ -0,0 +1,162 @@ +// EntryPointStats.h - Tracking statistics per entry point -*- 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: Apache-2.0

[clang] [analyzer] Introduce per-entry-point statistics (PR #131175)

2025-03-14 Thread Arseniy Zaostrovnykh via cfe-commits
https://github.com/necto updated https://github.com/llvm/llvm-project/pull/131175 >From 6b6d80d42d40d5917622cbc2bc0f2a454c34eca3 Mon Sep 17 00:00:00 2001 From: Arseniy Zaostrovnykh Date: Thu, 13 Mar 2025 18:42:39 +0100 Subject: [PATCH 1/5] [analyzer] Introduce per-entry-point statistics MIME-Ve

[clang] [analyzer] Introduce per-entry-point statistics (PR #131175)

2025-03-14 Thread Arseniy Zaostrovnykh via cfe-commits
https://github.com/necto updated https://github.com/llvm/llvm-project/pull/131175 >From 6b6d80d42d40d5917622cbc2bc0f2a454c34eca3 Mon Sep 17 00:00:00 2001 From: Arseniy Zaostrovnykh Date: Thu, 13 Mar 2025 18:42:39 +0100 Subject: [PATCH 1/4] [analyzer] Introduce per-entry-point statistics MIME-Ve

[clang] [analyzer] Introduce per-entry-point statistics (PR #131175)

2025-03-14 Thread Arseniy Zaostrovnykh via cfe-commits
https://github.com/necto updated https://github.com/llvm/llvm-project/pull/131175 >From 6b6d80d42d40d5917622cbc2bc0f2a454c34eca3 Mon Sep 17 00:00:00 2001 From: Arseniy Zaostrovnykh Date: Thu, 13 Mar 2025 18:42:39 +0100 Subject: [PATCH 1/2] [analyzer] Introduce per-entry-point statistics MIME-Ve

[clang] [analyzer] Introduce per-entry-point statistics (PR #131175)

2025-03-13 Thread Arseniy Zaostrovnykh via cfe-commits
https://github.com/necto created https://github.com/llvm/llvm-project/pull/131175 So far CSA was relying on the LLVM Statistic package that allowed us to gather some data about analysis of an entire translation unit. However, the translation unit consists of a collection of loosely related ent

[clang] [analyzer] Refine TimeTrace name for dispatchWorkItem (PR #128352)

2025-02-23 Thread Arseniy Zaostrovnykh via cfe-commits
https://github.com/necto approved this pull request. https://github.com/llvm/llvm-project/pull/128352 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Add time-trace scopes for high-level analyzer steps (PR #125508)

2025-02-21 Thread Arseniy Zaostrovnykh via cfe-commits
@@ -179,8 +181,41 @@ bool CoreEngine::ExecuteWorkList(const LocationContext *L, unsigned MaxSteps, return WList->hasWork(); } -void CoreEngine::dispatchWorkItem(ExplodedNode* Pred, ProgramPoint Loc, - const WorkListUnit& WU) { +static std::s

[clang] [analyzer][docs] Document how to use perf and uftrace to debug performance issues (PR #126724)

2025-02-11 Thread Arseniy Zaostrovnykh via cfe-commits
https://github.com/necto approved this pull request. https://github.com/llvm/llvm-project/pull/126724 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer][docs] Document how to use perf and uftrace to debug performance issues (PR #126724)

2025-02-11 Thread Arseniy Zaostrovnykh via cfe-commits
@@ -45,3 +47,91 @@ Note: Both Chrome-tracing and speedscope tools might struggle with time traces a Luckily, in most cases the default max-steps boundary of 225 000 produces the traces of approximately that size for a single entry point. You can use ``-analyze-function=get_gl

[clang] [analyzer][docs] Document how to use perf and uftrace to debug performance issues (PR #126724)

2025-02-11 Thread Arseniy Zaostrovnykh via cfe-commits
@@ -45,3 +47,91 @@ Note: Both Chrome-tracing and speedscope tools might struggle with time traces a Luckily, in most cases the default max-steps boundary of 225 000 produces the traces of approximately that size for a single entry point. You can use ``-analyze-function=get_gl

[clang] [analyzer][docs] Document how to use perf and uftrace to debug performance issues (PR #126520)

2025-02-10 Thread Arseniy Zaostrovnykh via cfe-commits
@@ -45,3 +48,91 @@ Note: Both Chrome-tracing and speedscope tools might struggle with time traces a Luckily, in most cases the default max-steps boundary of 225 000 produces the traces of approximately that size for a single entry point. You can use ``-analyze-function=get_gl

[clang] [analyzer][docs] Document how to use perf and uftrace to debug performance issues (PR #126520)

2025-02-10 Thread Arseniy Zaostrovnykh via cfe-commits
@@ -45,3 +48,91 @@ Note: Both Chrome-tracing and speedscope tools might struggle with time traces a Luckily, in most cases the default max-steps boundary of 225 000 produces the traces of approximately that size for a single entry point. You can use ``-analyze-function=get_gl

[clang] [analyzer][docs] Document how to use perf and uftrace to debug performance issues (PR #126520)

2025-02-10 Thread Arseniy Zaostrovnykh via cfe-commits
@@ -45,3 +48,91 @@ Note: Both Chrome-tracing and speedscope tools might struggle with time traces a Luckily, in most cases the default max-steps boundary of 225 000 produces the traces of approximately that size for a single entry point. You can use ``-analyze-function=get_gl

[clang] [analyzer][docs] Document how to use perf and uftrace to debug performance issues (PR #126520)

2025-02-10 Thread Arseniy Zaostrovnykh via cfe-commits
@@ -45,3 +48,91 @@ Note: Both Chrome-tracing and speedscope tools might struggle with time traces a Luckily, in most cases the default max-steps boundary of 225 000 produces the traces of approximately that size for a single entry point. You can use ``-analyze-function=get_gl

[clang] [analyzer][docs] Document how to use perf and uftrace to debug performance issues (PR #126520)

2025-02-10 Thread Arseniy Zaostrovnykh via cfe-commits
@@ -45,3 +48,91 @@ Note: Both Chrome-tracing and speedscope tools might struggle with time traces a Luckily, in most cases the default max-steps boundary of 225 000 produces the traces of approximately that size for a single entry point. You can use ``-analyze-function=get_gl

[clang] [analyzer][docs] Document how to use perf and uftrace to debug performance issues (PR #126520)

2025-02-10 Thread Arseniy Zaostrovnykh via cfe-commits
https://github.com/necto commented: One note about the illustrations: Thank you for adding them, I think they are invaluable to understand the docs! Yet, I feel they could be smaller both in detail and in the file sizes. - Fewer details means the reader will quicker understand the points you want

[clang] [analyzer] Add -ftime-trace scopes for region-store bindings and removeDead (PR #125884)

2025-02-06 Thread Arseniy Zaostrovnykh via cfe-commits
@@ -1031,6 +1032,7 @@ void ExprEngine::removeDead(ExplodedNode *Pred, ExplodedNodeSet &Out, const LocationContext *LC, const Stmt *DiagnosticStmt, ProgramPoint::Kind K) { + llvm::TimeTraceScop

[clang] [analyzer] Add -ftime-trace scopes for region-store bindings and removeDead (PR #125884)

2025-02-06 Thread Arseniy Zaostrovnykh via cfe-commits
https://github.com/necto edited https://github.com/llvm/llvm-project/pull/125884 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Add -ftime-trace scopes for region-store bindings and removeDead (PR #125884)

2025-02-06 Thread Arseniy Zaostrovnykh via cfe-commits
https://github.com/necto edited https://github.com/llvm/llvm-project/pull/125884 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Add -ftime-trace scopes for region-store bindings and removeDead (PR #125884)

2025-02-06 Thread Arseniy Zaostrovnykh via cfe-commits
@@ -1031,6 +1032,7 @@ void ExprEngine::removeDead(ExplodedNode *Pred, ExplodedNodeSet &Out, const LocationContext *LC, const Stmt *DiagnosticStmt, ProgramPoint::Kind K) { + llvm::TimeTraceScop

[clang] [analyzer] Add -ftime-trace scopes for region-store bindings and removeDead (PR #125884)

2025-02-05 Thread Arseniy Zaostrovnykh via cfe-commits
https://github.com/necto created https://github.com/llvm/llvm-project/pull/125884 >From investigation of a few slow analysis cases, I discovered that >`RegionStoreManager::bind*` and `ExprEngine::removeDead` are often the slowest >actions. This change adds explicit scope to the time trace gene

[clang] [analyzer] Add time-trace scopes for high-level analyzer steps (PR #125508)

2025-02-05 Thread Arseniy Zaostrovnykh via cfe-commits
necto wrote: > I had a look at the PR, and it looks awesome. Could you please update the > attached speedscope image? It looks like it's out of sync with the > implementation, for example if you look at the "Loc PostStmt { ... stuff here > ...}" , it appears to include the ProgramPoint dump, a

[clang] [analyzer] Add time-trace scopes for high-level analyzer steps (PR #125508)

2025-02-04 Thread Arseniy Zaostrovnykh via cfe-commits
@@ -179,8 +181,40 @@ bool CoreEngine::ExecuteWorkList(const LocationContext *L, unsigned MaxSteps, return WList->hasWork(); } -void CoreEngine::dispatchWorkItem(ExplodedNode* Pred, ProgramPoint Loc, - const WorkListUnit& WU) { +static std::s

[clang] [analyzer] Add time-trace scopes for high-level analyzer steps (PR #125508)

2025-02-04 Thread Arseniy Zaostrovnykh via cfe-commits
@@ -365,13 +388,22 @@ namespace { void runChecker(CheckerManager::CheckBindFunc checkFn, NodeBuilder &Bldr, ExplodedNode *Pred) { + llvm::TimeTraceScope TimeScope(checkerScopeName("Bind", checkFn.Checker)); const ProgramPoint &L = PP.withTa

[clang] [analyzer] Add time-trace scopes for high-level analyzer steps (PR #125508)

2025-02-04 Thread Arseniy Zaostrovnykh via cfe-commits
@@ -358,9 +359,41 @@ class AnalysisConsumer : public AnalysisASTConsumer, /// Print \p S to stderr if \c Opts.AnalyzerDisplayProgress is set. void reportAnalyzerProgress(StringRef S); -}; // namespace -} // end anonymous namespace +}; +std::string timeTraceScopeDeclName(

[clang] [analyzer] Add time-trace scopes for high-level analyzer steps (PR #125508)

2025-02-04 Thread Arseniy Zaostrovnykh via cfe-commits
@@ -134,6 +135,14 @@ static void expandGraphWithCheckers(CHECK_CTX checkCtx, namespace { +std::string checkerScopeName(StringRef name, const CheckerBase *checker) { + if (!llvm::timeTraceProfilerEnabled()) +return ""; + std::string checkerName = necto w

[clang] [analyzer] Add time-trace scopes for high-level analyzer steps (PR #125508)

2025-02-04 Thread Arseniy Zaostrovnykh via cfe-commits
@@ -119,6 +121,28 @@ class CacheInitializer : public DynamicRecursiveASTVisitor { Ranges &Result; }; +std::string timeScopeName(const Decl *DeclWithIssue) { + if (!llvm::timeTraceProfilerEnabled()) +return ""; + return llvm::formatv( + "BugSuppression::isS

[clang] [analyzer] Add time-trace scopes for high-level analyzer steps (PR #125508)

2025-02-04 Thread Arseniy Zaostrovnykh via cfe-commits
@@ -287,6 +288,34 @@ class PathDiagnosticBuilder : public BugReporterContext { const PathSensitiveBugReport *getBugReport() const { return R; } }; +std::string timeTraceName(const BugReportEquivClass &EQ) { + if (!llvm::timeTraceProfilerEnabled()) +return ""; + const a

[clang] [analyzer] Add time-trace scopes for high-level analyzer steps (PR #125508)

2025-02-04 Thread Arseniy Zaostrovnykh via cfe-commits
@@ -119,6 +121,28 @@ class CacheInitializer : public DynamicRecursiveASTVisitor { Ranges &Result; }; +std::string timeScopeName(const Decl *DeclWithIssue) { + if (!llvm::timeTraceProfilerEnabled()) +return ""; + return llvm::formatv( + "BugSuppression::isS

[clang] [analyzer] Add time-trace scopes for high-level analyzer steps (PR #125508)

2025-02-04 Thread Arseniy Zaostrovnykh via cfe-commits
@@ -358,9 +359,41 @@ class AnalysisConsumer : public AnalysisASTConsumer, /// Print \p S to stderr if \c Opts.AnalyzerDisplayProgress is set. void reportAnalyzerProgress(StringRef S); -}; // namespace -} // end anonymous namespace +}; +std::string timeTraceScopeDeclName(

[clang] [analyzer] Add time-trace scopes for high-level analyzer steps (PR #125508)

2025-02-04 Thread Arseniy Zaostrovnykh via cfe-commits
@@ -287,6 +288,34 @@ class PathDiagnosticBuilder : public BugReporterContext { const PathSensitiveBugReport *getBugReport() const { return R; } }; +std::string timeTraceName(const BugReportEquivClass &EQ) { + if (!llvm::timeTraceProfilerEnabled()) +return ""; + const a

[clang] [analyzer] Add time-trace scopes for high-level analyzer steps (PR #125508)

2025-02-04 Thread Arseniy Zaostrovnykh via cfe-commits
@@ -287,6 +288,34 @@ class PathDiagnosticBuilder : public BugReporterContext { const PathSensitiveBugReport *getBugReport() const { return R; } }; +std::string timeTraceName(const BugReportEquivClass &EQ) { + if (!llvm::timeTraceProfilerEnabled()) +return ""; + const a

[clang] [analyzer] Add time-trace scopes for high-level analyzer steps (PR #125508)

2025-02-04 Thread Arseniy Zaostrovnykh via cfe-commits
@@ -49,6 +49,127 @@ LLVM_DUMP_METHOD void ProgramPoint::dump() const { return printJson(llvm::errs()); } +const char *ProgramPoint::kindToStr(Kind K) { + switch (K) { + case BlockEdgeKind: +return "BlockEdge"; + case BlockEntranceKind: +return "BlockEntrance"; +

[clang] [analyzer] Add time-trace scopes for high-level analyzer steps (PR #125508)

2025-02-04 Thread Arseniy Zaostrovnykh via cfe-commits
@@ -287,6 +288,35 @@ class PathDiagnosticBuilder : public BugReporterContext { const PathSensitiveBugReport *getBugReport() const { return R; } }; +std::string timeTraceName(const BugReportEquivClass &EQ) { + if (!llvm::timeTraceProfilerEnabled()) { necto w

[clang] [analyzer] Add time-trace scopes for high-level analyzer steps (PR #125508)

2025-02-04 Thread Arseniy Zaostrovnykh via cfe-commits
@@ -49,6 +49,127 @@ LLVM_DUMP_METHOD void ProgramPoint::dump() const { return printJson(llvm::errs()); } +const char *ProgramPoint::kindToStr(Kind K) { + switch (K) { + case BlockEdgeKind: +return "BlockEdge"; + case BlockEntranceKind: +return "BlockEntrance"; +

[clang] [analyzer] Add time-trace scopes for high-level analyzer steps (PR #125508)

2025-02-04 Thread Arseniy Zaostrovnykh via cfe-commits
@@ -49,6 +49,127 @@ LLVM_DUMP_METHOD void ProgramPoint::dump() const { return printJson(llvm::errs()); } +const char *ProgramPoint::kindToStr(Kind K) { necto wrote: Indeed, I changed the return type in a22ed13eae22 [NFC] Return StringRef instead of a raw ch

[clang] [analyzer] Add time-trace scopes for high-level analyzer steps (PR #125508)

2025-02-04 Thread Arseniy Zaostrovnykh via cfe-commits
@@ -0,0 +1,38 @@ += +Performance Investigation += + +Multiple factors contribute to the time it takes to analyze a file with Clang Static Analyzer. +A translation unit contains multiple entry points, each of which take multiple ste

[clang] [analyzer] Add time-trace scopes for high-level analyzer steps (PR #125508)

2025-02-04 Thread Arseniy Zaostrovnykh via cfe-commits
@@ -0,0 +1,38 @@ += +Performance Investigation += + +Multiple factors contribute to the time it takes to analyze a file with Clang Static Analyzer. +A translation unit contains multiple entry points, each of which take multiple ste

[clang] [analyzer] Add time-trace scopes for high-level analyzer steps (PR #125508)

2025-02-04 Thread Arseniy Zaostrovnykh via cfe-commits
necto wrote: > Does this also work when CSA is called through clang-tidy? The analyzer > profiling data in missing in the `--enable-check-profile` output - see #73673? As far as I know, it does not work out of the box with clang-tidy. Time tracing works only if you setup a profiler singleton i

[clang] [analyzer][docs] CSA release notes for clang-20 (PR #124798)

2025-01-28 Thread Arseniy Zaostrovnykh via cfe-commits
https://github.com/necto approved this pull request. I don't know the best practices related to release notes, but the changes look good to me https://github.com/llvm/llvm-project/pull/124798 ___ cfe-commits mailing list cfe-commits@lists.llvm.org htt

[clang] [clang] Fix false warning on reinterpret_casting unknown template type (PR #109430)

2025-01-20 Thread Arseniy Zaostrovnykh via cfe-commits
necto wrote: @cor3ntin is it good to go now? https://github.com/llvm/llvm-project/pull/109430 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Fix false warning on reinterpret_casting unknown template type (PR #109430)

2025-01-15 Thread Arseniy Zaostrovnykh via cfe-commits
https://github.com/necto updated https://github.com/llvm/llvm-project/pull/109430 >From 3533863fd58f54d2d5570b4f593d2635e1e11aa8 Mon Sep 17 00:00:00 2001 From: Arseniy Zaostrovnykh Date: Fri, 20 Sep 2024 09:16:17 +0200 Subject: [PATCH 1/3] [clang] Fix false warning on reinterpret_casting unknow

[clang] [clang] Fix false warning on reinterpret_casting unknown template type (PR #109430)

2025-01-15 Thread Arseniy Zaostrovnykh via cfe-commits
https://github.com/necto updated https://github.com/llvm/llvm-project/pull/109430 >From 3533863fd58f54d2d5570b4f593d2635e1e11aa8 Mon Sep 17 00:00:00 2001 From: Arseniy Zaostrovnykh Date: Fri, 20 Sep 2024 09:16:17 +0200 Subject: [PATCH 1/3] [clang] Fix false warning on reinterpret_casting unknow

[clang] [clang] Fix false warning on reinterpret_casting unknown template type (PR #109430)

2025-01-15 Thread Arseniy Zaostrovnykh via cfe-commits
necto wrote: > Hum, this actually need a release note, can you edit > clang/docs/ReleaseNotes.rst? Thanks Added: e0db8fb776c8 https://github.com/llvm/llvm-project/pull/109430 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm

[clang] [clang] Fix false warning on reinterpret_casting unknown template type (PR #109430)

2025-01-13 Thread Arseniy Zaostrovnykh via cfe-commits
necto wrote: > LGTM. Do you need me to merge that for you? Yes, please https://github.com/llvm/llvm-project/pull/109430 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [NFC] [analyzer] Factor out SymbolManager::get<*> (PR #121781)

2025-01-07 Thread Arseniy Zaostrovnykh via cfe-commits
@@ -525,14 +527,14 @@ class SymbolManager { static bool canSymbolicate(QualType T); - /// Make a unique symbol for MemRegion R according to its kind. - const SymbolRegionValue* getRegionValueSymbol(const TypedValueRegion* R); + template const T *get(Args &&...args); ---

[clang] [NFC] [analyzer] Factor out SymbolManager::get<*> (PR #121781)

2025-01-07 Thread Arseniy Zaostrovnykh via cfe-commits
https://github.com/necto updated https://github.com/llvm/llvm-project/pull/121781 >From 08b838adf275f1e0eaf2ab3e3d4b2b6d89bf4ed6 Mon Sep 17 00:00:00 2001 From: Arseniy Zaostrovnykh Date: Mon, 6 Jan 2025 14:37:08 +0100 Subject: [PATCH 01/12] [NFC] Replace getRegionValueSymbol with get This sho

[clang] [NFC] [analyzer] Factor out SymbolManager::get<*> (PR #121781)

2025-01-07 Thread Arseniy Zaostrovnykh via cfe-commits
@@ -525,14 +527,14 @@ class SymbolManager { static bool canSymbolicate(QualType T); - /// Make a unique symbol for MemRegion R according to its kind. - const SymbolRegionValue* getRegionValueSymbol(const TypedValueRegion* R); + template const T *get(Args &&...args); ---

[clang] [NFC] [analyzer] Factor out SymbolManager::get<*> (PR #121781)

2025-01-06 Thread Arseniy Zaostrovnykh via cfe-commits
https://github.com/necto updated https://github.com/llvm/llvm-project/pull/121781 >From 08b838adf275f1e0eaf2ab3e3d4b2b6d89bf4ed6 Mon Sep 17 00:00:00 2001 From: Arseniy Zaostrovnykh Date: Mon, 6 Jan 2025 14:37:08 +0100 Subject: [PATCH 01/11] [NFC] Replace getRegionValueSymbol with get This sho

[clang] [NFC] [analyzer] Factor out SymbolManager::get<*> (PR #121781)

2025-01-06 Thread Arseniy Zaostrovnykh via cfe-commits
necto wrote: @NagyDonat Here is the refactoring you suggested in https://github.com/llvm/llvm-project/pull/121551 I made sure `check-clang-analysis` passes after each commit, so I think reviewing it by commit should be easier than all at once. https://github.com/llvm/llvm-project/pull/121781

[clang] [NFC] [analyzer] Factor out SymbolManager::get<*> (PR #121781)

2025-01-06 Thread Arseniy Zaostrovnykh via cfe-commits
https://github.com/necto created https://github.com/llvm/llvm-project/pull/121781 Replace the family of `SymbolManager::get*Symbol(...)` member functions with a single generic `SymbolManager::get<*>` member function. >From 08b838adf275f1e0eaf2ab3e3d4b2b6d89bf4ed6 Mon Sep 17 00:00:00 2001 From:

[clang] [clang][analyzer] Stable order for SymbolRef-keyed containers (PR #121749)

2025-01-06 Thread Arseniy Zaostrovnykh via cfe-commits
necto wrote: @steakhal I've fixed the buildbot error ensued after https://github.com/llvm/llvm-project/pull/121551 was merged https://github.com/llvm/llvm-project/pull/121749 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.o

[clang] [clang][analyzer] Stable order for SymbolRef-keyed containers (PR #121749)

2025-01-06 Thread Arseniy Zaostrovnykh via cfe-commits
https://github.com/necto created https://github.com/llvm/llvm-project/pull/121749 Generalize the SymbolIDs used for SymbolData to all SymExprs and use these IDs for comparison SymbolRef keys in various containers, such as ConstraintMap. These IDs are superior to raw pointer values because they

[clang] [clang][analyzer] Stable order for SymbolRef-keyed containers (PR #121551)

2025-01-03 Thread Arseniy Zaostrovnykh via cfe-commits
https://github.com/necto updated https://github.com/llvm/llvm-project/pull/121551 >From 115814c2776b6acc8f4a08ec696a3cb27a7c0ebd Mon Sep 17 00:00:00 2001 From: Arseniy Zaostrovnykh Date: Thu, 2 Jan 2025 09:58:53 +0100 Subject: [PATCH 1/4] Add SymbolID to every SymExpr, not just SymbolData ---

[clang] [clang][analyzer] Stable order for SymbolRef-keyed containers (PR #121551)

2025-01-03 Thread Arseniy Zaostrovnykh via cfe-commits
necto wrote: > By the way, what fraction of the results is perturbed (replaced with other > random results) when this commit is activated? Did you run any "without this > commit vs with this commit" comparisons? The difference is around 5-10 appearing/disappearing issues, and 50-100 issues wi

[clang] [clang][analyzer] Stable order for SymbolRef-keyed containers (PR #121551)

2025-01-03 Thread Arseniy Zaostrovnykh via cfe-commits
@@ -56,6 +68,8 @@ class SymExpr : public llvm::FoldingSetNode { Kind getKind() const { return K; } + SymbolID getSymbolID() const { return Sym; } necto wrote: Documented in 355c588f4469 az/order-by-symref-id [NFC] A doc comment explaining the SymExpr::ge

[clang] [clang][analyzer] Stable order for SymbolRef-keyed containers (PR #121551)

2025-01-03 Thread Arseniy Zaostrovnykh via cfe-commits
https://github.com/necto updated https://github.com/llvm/llvm-project/pull/121551 >From 115814c2776b6acc8f4a08ec696a3cb27a7c0ebd Mon Sep 17 00:00:00 2001 From: Arseniy Zaostrovnykh Date: Thu, 2 Jan 2025 09:58:53 +0100 Subject: [PATCH 1/5] Add SymbolID to every SymExpr, not just SymbolData ---

[clang] [clang][analyzer] Stable order for SymbolRef-keyed containers (PR #121551)

2025-01-03 Thread Arseniy Zaostrovnykh via cfe-commits
@@ -687,4 +711,35 @@ class SymbolVisitor { } // namespace clang +// Override the default definition that would use pointer values of SymbolRefs +// to order them, which is unstable due to ASLR. +// Use the SymbolID instead which reflect the order in which the symbols were +//

[clang] [clang][analyzer] Stable order for SymbolRef-keyed containers (PR #121551)

2025-01-03 Thread Arseniy Zaostrovnykh via cfe-commits
@@ -687,4 +711,35 @@ class SymbolVisitor { } // namespace clang +// Override the default definition that would use pointer values of SymbolRefs +// to order them, which is unstable due to ASLR. +// Use the SymbolID instead which reflect the order in which the symbols were +//

[clang] [clang][analyzer] Stable order for SymbolRef-keyed containers (PR #121551)

2025-01-03 Thread Arseniy Zaostrovnykh via cfe-commits
@@ -687,4 +711,35 @@ class SymbolVisitor { } // namespace clang +// Override the default definition that would use pointer values of SymbolRefs +// to order them, which is unstable due to ASLR. +// Use the SymbolID instead which reflect the order in which the symbols were +//

[clang] [clang][analyzer] Stable order for SymbolRef-keyed containers (PR #121551)

2025-01-03 Thread Arseniy Zaostrovnykh via cfe-commits
necto wrote: > That being said, do we know how exactly the unstable addresses result in > unstable results? One mechanism that we studied in the past weeks is the SMT issue refutation: assertion order is that of the constraint order in the `ConstraintMap`, and it turns out Z3 runs a query dif

[clang] [clang][analyzer] Stable order for SymbolRef-keyed containers (PR #121551)

2025-01-03 Thread Arseniy Zaostrovnykh via cfe-commits
https://github.com/necto edited https://github.com/llvm/llvm-project/pull/121551 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][analyzer] Stabilize path-constraint order by using alloc IDs (PR #121347)

2025-01-03 Thread Arseniy Zaostrovnykh via cfe-commits
necto wrote: Superseded by https://github.com/llvm/llvm-project/pull/121551 https://github.com/llvm/llvm-project/pull/121347 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][analyzer] Stabilize path-constraint order by using alloc IDs (PR #121347)

2025-01-03 Thread Arseniy Zaostrovnykh via cfe-commits
https://github.com/necto closed https://github.com/llvm/llvm-project/pull/121347 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][analyzer] Stabilize path-constraint order by using alloc IDs (PR #121347)

2025-01-03 Thread Arseniy Zaostrovnykh via cfe-commits
@@ -427,8 +434,8 @@ class BinarySymExprImpl : public BinarySymExpr { public: BinarySymExprImpl(LHSTYPE lhs, BinaryOperator::Opcode op, RHSTYPE rhs, -QualType t) - : BinarySymExpr(ClassKind, op, t), LHS(lhs), RHS(rhs) { +QualType t

[clang] [clang][analyzer] Stabilize path-constraint order by using alloc IDs (PR #121347)

2025-01-03 Thread Arseniy Zaostrovnykh via cfe-commits
@@ -401,7 +401,22 @@ class RangeSet { friend class Factory; }; -using ConstraintMap = llvm::ImmutableMap; +struct ConstraintKVInfo : llvm::ImutKeyValueInfo { + static inline bool isEqual(key_type_ref L, key_type_ref R) { +return L->getAllocID() == R->getAllocID(); + }

[clang] [clang][analyzer] Stable order for SymbolRef-keyed containers (PR #121551)

2025-01-03 Thread Arseniy Zaostrovnykh via cfe-commits
necto wrote: @steakhal @NagyDonat, I revised and improved #121347. To facilitate review, I broke the change down into 3 self-contained commits. let tests pass after each of them. I re-evaluated this version and discovered no difference in the analysis outcome. https://github.com/llvm/llvm-proj

[clang] [clang][analyzer] Stable order for SymbolRef-keyed containers (PR #121551)

2025-01-03 Thread Arseniy Zaostrovnykh via cfe-commits
https://github.com/necto edited https://github.com/llvm/llvm-project/pull/121551 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][analyzer] Stable order for SymbolRef-keyed containers (PR #121551)

2025-01-03 Thread Arseniy Zaostrovnykh via cfe-commits
https://github.com/necto created https://github.com/llvm/llvm-project/pull/121551 Generalize the `SymbolID`s used for `SymbolData` to all `SymExpr`s and use these IDs for comparison `SymbolRef` keys in various containers, such as `ConstraintMap`. These IDs are superior to raw pointer values be

[clang] [clang][analyzer] Stabilize path-constraint order by using alloc IDs (PR #121347)

2025-01-02 Thread Arseniy Zaostrovnykh via cfe-commits
necto wrote: > Does the unstable constraint order only affect Z3 refutation, or did you > measure/notice differences in report flakyness even without Z3 refutation? I > think it would be great to see the impact of this change, while we eliminate > the Z3 from the equation. I've measured it n

[clang] [clang][analyzer] Stabilize path-constraint order by using alloc IDs (PR #121347)

2025-01-02 Thread Arseniy Zaostrovnykh via cfe-commits
@@ -401,7 +401,22 @@ class RangeSet { friend class Factory; }; -using ConstraintMap = llvm::ImmutableMap; +struct ConstraintKVInfo : llvm::ImutKeyValueInfo { + static inline bool isEqual(key_type_ref L, key_type_ref R) { +return L->getAllocID() == R->getAllocID(); + }

[clang] [clang][analyzer] Stabilize path-constraint order by using alloc IDs (PR #121347)

2025-01-02 Thread Arseniy Zaostrovnykh via cfe-commits
@@ -427,8 +434,8 @@ class BinarySymExprImpl : public BinarySymExpr { public: BinarySymExprImpl(LHSTYPE lhs, BinaryOperator::Opcode op, RHSTYPE rhs, -QualType t) - : BinarySymExpr(ClassKind, op, t), LHS(lhs), RHS(rhs) { +QualType t

[clang] [clang][analyzer] Stabilize path-constraint order by using alloc IDs (PR #121347)

2024-12-30 Thread Arseniy Zaostrovnykh via cfe-commits
necto wrote: Hey, @steakhal, @NagyDonat I am working caching Z3 refutation query outcomes to reduce the number of flaky issues, and constraint order is important to maximize the cache-hit rate. Turns out, global constraint order is beneficial regardless query cache. Would you take a look? BT

[clang] [clang][analyzer] Stabilize path-constraint order by using alloc IDs (PR #121347)

2024-12-30 Thread Arseniy Zaostrovnykh via cfe-commits
https://github.com/necto edited https://github.com/llvm/llvm-project/pull/121347 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][analyzer] Stabilize path-constraint order by using alloc IDs (PR #121347)

2024-12-30 Thread Arseniy Zaostrovnykh via cfe-commits
https://github.com/necto edited https://github.com/llvm/llvm-project/pull/121347 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][analyzer] Stabilize path-constraint order by using alloc IDs (PR #121347)

2024-12-30 Thread Arseniy Zaostrovnykh via cfe-commits
https://github.com/necto created https://github.com/llvm/llvm-project/pull/121347 These IDs are essentially allocator offsets for the SymExpr pool. They are superior to raw pointer values because they are more controllable and are not randomized across executions. They are not stable across r

[clang] [analyzer][NFC] Introduce APSIntPtr, a safe wrapper of APSInt (1/4) (PR #120435)

2024-12-19 Thread Arseniy Zaostrovnykh via cfe-commits
https://github.com/necto approved this pull request. https://github.com/llvm/llvm-project/pull/120435 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer][NFC] Introduce APSIntPtr, a safe wrapper of APSInt (1/4) (PR #120435)

2024-12-19 Thread Arseniy Zaostrovnykh via cfe-commits
@@ -165,79 +166,70 @@ class BasicValueFactory { /// Convert - Create a new persistent APSInt with the same value as 'From' /// but with the bitwidth and signedness of 'To'. - const llvm::APSInt &Convert(const llvm::APSInt& To, - const llvm::A

[clang] [analyzer][NFC] Introduce APSIntPtr, a safe wrapper of APSInt (1/4) (PR #120435)

2024-12-19 Thread Arseniy Zaostrovnykh via cfe-commits
https://github.com/necto requested changes to this pull request. https://github.com/llvm/llvm-project/pull/120435 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer][NFC] Introduce APSIntPtr, a safe wrapper of APSInt (1/4) (PR #120435)

2024-12-19 Thread Arseniy Zaostrovnykh via cfe-commits
@@ -0,0 +1,64 @@ +//== APSIntPtr.h - Wrapper for APSInt objects owned separately -*- 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: Apach

  1   2   3   >