[llvm] Add DebugSSAUpdater class to track debug value liveness (PR #135349)

Jeremy Morse via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 28 18:04:02 PDT 2025


================
@@ -0,0 +1,351 @@
+//===- DebugSSAUpdater.h - Debug SSA Update Tool ----------------*- 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 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// This file declares the DebugSSAUpdater class, which is used to evaluate the
+// live values of debug variables in IR. This uses SSA construction, treating
+// debug value records as definitions, to determine at each point in the program
+// which definition(s) are live at a given point. This is useful for analysis of
+// the state of debug variables, such as measuring the change in values of a
+// variable over time, or calculating coverage stats.
+//
----------------
jmorse wrote:

I feel like we should add a rider/warning about how "If you're using this in an optimisation pass you're doing it wrong". i.e., computing the dominance frontiers of the debug variables is expensive and shouldn't be done lightly. Adding such a warning will discourage people from submitting patches to optimisations using DebugSSAUpdater that we then have to reject on the basis of the compile-time cost.

https://github.com/llvm/llvm-project/pull/135349


More information about the llvm-commits mailing list