[llvm] da843aa - [DebugInfo][RemoveDIs] Add flag to use "new" debug-info in opt (#71937)

via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 14 05:42:50 PST 2023


Author: Jeremy Morse
Date: 2023-11-14T13:42:45Z
New Revision: da843aa09f4cb5caab1cf0c802f2d203ada84c54

URL: https://github.com/llvm/llvm-project/commit/da843aa09f4cb5caab1cf0c802f2d203ada84c54
DIFF: https://github.com/llvm/llvm-project/commit/da843aa09f4cb5caab1cf0c802f2d203ada84c54.diff

LOG: [DebugInfo][RemoveDIs] Add flag to use "new" debug-info  in opt (#71937)

Our option to turn on the non-intrinsic form of debug-info
(`--experimental-debuginfo-iterators`) currently requires that LLVM is
built with the `LLVM_EXPERIMENTAL_DEBUGINFO_ITERATORS` cmake flag
enabled, so that some (slight) performance regressions aren't
on-by-default during the prototype/testing period. However, we still
want to be able to _optionally_ run tests, if support is built into
LLVM.

To allow optionally exercising the non-intrinsic debug-info code, this
patch adds `--try-experimental-debuginfo-iterators` to opt, which turns
the `--experimental-debuginfo-iterators` flag on if support is built in,
or leaves it off. This means we can run tests that:
 * Use normal dbg.value intrinsics if there's no support, or
 * Uses non-instruction DPValues if there is support.
  
Which means we can start getting test coverage of DPValues/RemoveDIs
behaviour, from in-tree tests, on our RemoveDIs buildbot. All the code
to do with automagically converting from one form to the other landed in
10a9e7442c4c4e.

Added: 
    

Modified: 
    llvm/tools/opt/opt.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/tools/opt/opt.cpp b/llvm/tools/opt/opt.cpp
index bb6627364442ef7..5e5e5ce233f310a 100644
--- a/llvm/tools/opt/opt.cpp
+++ b/llvm/tools/opt/opt.cpp
@@ -279,6 +279,13 @@ static cl::list<std::string>
     PassPlugins("load-pass-plugin",
                 cl::desc("Load passes from plugin library"));
 
+static cl::opt<bool> TryUseNewDbgInfoFormat(
+    "try-experimental-debuginfo-iterators",
+    cl::desc("Enable debuginfo iterator positions, if they're built in"),
+    cl::init(false));
+
+extern cl::opt<bool> UseNewDbgInfoFormat;
+
 //===----------------------------------------------------------------------===//
 // CodeGen-related helper functions.
 //
@@ -452,6 +459,17 @@ int main(int argc, char **argv) {
   cl::ParseCommandLineOptions(argc, argv,
     "llvm .bc -> .bc modular optimizer and analysis printer\n");
 
+  // RemoveDIs debug-info transition: tests may request that we /try/ to use the
+  // new debug-info format, if it's built in.
+#ifdef EXPERIMENTAL_DEBUGINFO_ITERATORS
+  if (TryUseNewDbgInfoFormat) {
+    // If LLVM was built with support for this, turn the new debug-info format
+    // on.
+    UseNewDbgInfoFormat = true;
+  }
+#endif
+  (void)TryUseNewDbgInfoFormat;
+
   LLVMContext Context;
 
   // TODO: remove shouldForceLegacyPM().


        


More information about the llvm-commits mailing list