Skip to content

Commit 37eff87

Browse files
jmorsezahiraam
authored andcommitted
[DebugInfo][RemoveDIs] Add flag to use "new" debug-info in opt (llvm#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 10a9e74.
1 parent 3432ad2 commit 37eff87

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

llvm/tools/opt/opt.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,13 @@ static cl::list<std::string>
279279
PassPlugins("load-pass-plugin",
280280
cl::desc("Load passes from plugin library"));
281281

282+
static cl::opt<bool> TryUseNewDbgInfoFormat(
283+
"try-experimental-debuginfo-iterators",
284+
cl::desc("Enable debuginfo iterator positions, if they're built in"),
285+
cl::init(false));
286+
287+
extern cl::opt<bool> UseNewDbgInfoFormat;
288+
282289
//===----------------------------------------------------------------------===//
283290
// CodeGen-related helper functions.
284291
//
@@ -452,6 +459,17 @@ int main(int argc, char **argv) {
452459
cl::ParseCommandLineOptions(argc, argv,
453460
"llvm .bc -> .bc modular optimizer and analysis printer\n");
454461

462+
// RemoveDIs debug-info transition: tests may request that we /try/ to use the
463+
// new debug-info format, if it's built in.
464+
#ifdef EXPERIMENTAL_DEBUGINFO_ITERATORS
465+
if (TryUseNewDbgInfoFormat) {
466+
// If LLVM was built with support for this, turn the new debug-info format
467+
// on.
468+
UseNewDbgInfoFormat = true;
469+
}
470+
#endif
471+
(void)TryUseNewDbgInfoFormat;
472+
455473
LLVMContext Context;
456474

457475
// TODO: remove shouldForceLegacyPM().

0 commit comments

Comments
 (0)