[llvm] cc36533 - [DLCov] Origin-Tracking: Add config options (#143590)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 13 04:54:33 PDT 2025
Author: Stephen Tozer
Date: 2025-06-13T12:54:30+01:00
New Revision: cc365331af423de99ae98655d035e4892842fe97
URL: https://github.com/llvm/llvm-project/commit/cc365331af423de99ae98655d035e4892842fe97
DIFF: https://github.com/llvm/llvm-project/commit/cc365331af423de99ae98655d035e4892842fe97.diff
LOG: [DLCov] Origin-Tracking: Add config options (#143590)
This patch is part of a series that adds origin-tracking to the debugify
source location coverage checks, allowing us to report symbolized stack
traces of the point where missing source locations appear.
This patch adds the configuration options needed to enable this feature,
in the form of a new CMake option that enables a flag in
`llvm-config.h`; this is not an entirely new CMake flag, but a new
option, `COVERAGE_AND_ORIGIN`, for the existing flag
`LLVM_ENABLE_DEBUGLOC_COVERAGE_TRACKING`. This patch contains
documentation, but no actual implementation for the flag itself.
Added:
Modified:
llvm/CMakeLists.txt
llvm/cmake/modules/HandleLLVMOptions.cmake
llvm/docs/CMake.rst
llvm/include/llvm/Config/llvm-config.h.cmake
Removed:
################################################################################
diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt
index cfb67472aa71e..0849bec26d56a 100644
--- a/llvm/CMakeLists.txt
+++ b/llvm/CMakeLists.txt
@@ -569,8 +569,8 @@ endif()
option(LLVM_ENABLE_CRASH_DUMPS "Turn on memory dumps on crashes. Currently only implemented on Windows." OFF)
set(LLVM_ENABLE_DEBUGLOC_COVERAGE_TRACKING "DISABLED" CACHE STRING
- "Enhance Debugify's line number coverage tracking; enabling this is ABI-breaking. Can be DISABLED, or COVERAGE.")
-set_property(CACHE LLVM_ENABLE_DEBUGLOC_COVERAGE_TRACKING PROPERTY STRINGS DISABLED COVERAGE)
+ "Enhance Debugify's line number coverage tracking; enabling this is ABI-breaking. Can be DISABLED, COVERAGE, or COVERAGE_AND_ORIGIN.")
+set_property(CACHE LLVM_ENABLE_DEBUGLOC_COVERAGE_TRACKING PROPERTY STRINGS DISABLED COVERAGE COVERAGE_AND_ORIGIN)
option(LLVM_EXPERIMENTAL_KEY_INSTRUCTIONS
"Add additional fields to DILocations to support Key Instructions" OFF)
diff --git a/llvm/cmake/modules/HandleLLVMOptions.cmake b/llvm/cmake/modules/HandleLLVMOptions.cmake
index 9721dacbcbe84..c35d9763a3301 100644
--- a/llvm/cmake/modules/HandleLLVMOptions.cmake
+++ b/llvm/cmake/modules/HandleLLVMOptions.cmake
@@ -200,6 +200,9 @@ string(TOUPPER "${LLVM_ENABLE_DEBUGLOC_COVERAGE_TRACKING}" uppercase_LLVM_ENABLE
if( uppercase_LLVM_ENABLE_DEBUGLOC_COVERAGE_TRACKING STREQUAL "COVERAGE" )
set( LLVM_ENABLE_DEBUGLOC_COVERAGE_TRACKING 1 )
+elseif( uppercase_LLVM_ENABLE_DEBUGLOC_COVERAGE_TRACKING STREQUAL "COVERAGE_AND_ORIGIN" )
+ set( LLVM_ENABLE_DEBUGLOC_COVERAGE_TRACKING 1 )
+ set( LLVM_ENABLE_DEBUGLOC_ORIGIN_TRACKING 1 )
elseif( uppercase_LLVM_ENABLE_DEBUGLOC_COVERAGE_TRACKING STREQUAL "DISABLED" OR NOT DEFINED LLVM_ENABLE_DEBUGLOC_COVERAGE_TRACKING )
# The DISABLED setting is default and requires no additional defines.
else()
diff --git a/llvm/docs/CMake.rst b/llvm/docs/CMake.rst
index 674e4969c6912..72f19fd353922 100644
--- a/llvm/docs/CMake.rst
+++ b/llvm/docs/CMake.rst
@@ -482,11 +482,14 @@ enabled sub-projects. Nearly all of these variable names begin with
**LLVM_ENABLE_DEBUGLOC_COVERAGE_TRACKING**:STRING
Enhances Debugify's ability to detect line number errors by storing extra
information inside Instructions, removing false positives from Debugify's
- results at the cost of performance. Allowed values are `DISABLED` (default)
- and `COVERAGE`. `COVERAGE` tracks whether and why a line number was
- intentionally dropped or not generated for an instruction, allowing Debugify
- to avoid reporting these as errors; this comes with a small performance cost
- of ~0.1%. `COVERAGE` is an ABI-breaking option.
+ results at the cost of performance. Allowed values are `DISABLED` (default),
+ `COVERAGE`, and `COVERAGE_AND_ORIGIN`. `COVERAGE` tracks whether and why a
+ line number was intentionally dropped or not generated for an instruction,
+ allowing Debugify to avoid reporting these as errors; this comes with a small
+ performance cost of ~0.1%. `COVERAGE_AND_ORIGIN` additionally stores a
+ stacktrace of the point where each DebugLoc is unintentionally dropped,
+ allowing for much easier bug triaging at the cost of a ~10x performance
+ slowdown. `COVERAGE` and `COVERAGE_AND_ORIGIN` are ABI-breaking options.
**LLVM_ENABLE_DIA_SDK**:BOOL
Enable building with MSVC DIA SDK for PDB debugging support. Available
diff --git a/llvm/include/llvm/Config/llvm-config.h.cmake b/llvm/include/llvm/Config/llvm-config.h.cmake
index dbc882937b4f4..6d3c37cc8b194 100644
--- a/llvm/include/llvm/Config/llvm-config.h.cmake
+++ b/llvm/include/llvm/Config/llvm-config.h.cmake
@@ -133,4 +133,8 @@
and to 0 otherwise. */
#cmakedefine01 LLVM_ENABLE_DEBUGLOC_COVERAGE_TRACKING
+/* Define to 1 to enable expensive tracking of the origin of debug location
+ coverage bugs, and to 0 otherwise. */
+#cmakedefine01 LLVM_ENABLE_DEBUGLOC_ORIGIN_TRACKING
+
#endif
More information about the llvm-commits
mailing list