diff options
author | Jeremy Morse <jeremy.morse@sony.com> | 2025-04-09 18:00:28 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-04-09 18:00:28 +0100 |
commit | 40f9bb9e250d5762ee9cedabc7b7704c4cccddde (patch) | |
tree | 09449fa4934fd895a96d2ffee3d2aa98f8d3ddf3 /llvm/lib/Bitcode/Reader/BitcodeReader.cpp | |
parent | 0eb560a4dee05a55781f44c60c8164aef3bcf04c (diff) | |
download | llvm-40f9bb9e250d5762ee9cedabc7b7704c4cccddde.zip llvm-40f9bb9e250d5762ee9cedabc7b7704c4cccddde.tar.gz llvm-40f9bb9e250d5762ee9cedabc7b7704c4cccddde.tar.bz2 |
[DebugInfo][RemoveDIs] Eliminate another debug-info variation flag (#133917)
The "preserve input debug-info format" flag allowed some tooling to opt
into not seeing the new debug records yet, and to not autoupgrade. This
was good at the time, but un-necessary now that we'll be ditching
intrinsics shortly.
It also hides errors now: verify-uselistorder was hardcoding this flag
to on, and as a result it hasn't seen debug records before. Thus, we
missed a uselistorder variation: constant-expressions such as GEPs can
be contained within debug records and completely isolated from the value
hierachy, see the metadata-use-uselistorder.ll test. These Values didn't
get ordered, but were legitimate uses of constants like "i64 0", and we
now run into difficulty handling that. The patch to AsmWriter seeks
Values to order even through debug-info now.
Finally there are a few intrinsics-tests relying on this flag that we
can just delete, such as one in llvm-reduce and another few in the
LocalTest unit tests. For the fast-isel test, it was added in
https://reviews.llvm.org/D67703 explicitly for checking the size of
blocks without debug-info and in 1525abb9c94 the codepath it tests moved
towards being sunsetted. It'll be totally redundant once RemoveDIs is on
permanently.
Note that there's now no explicit test for the textual-IR autoupgrade
path. I submit that we can rely on the thousands of .ll files where
we've only been bothered to update the outputs, not the inputs, to debug
records.
Diffstat (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.cpp')
-rw-r--r-- | llvm/lib/Bitcode/Reader/BitcodeReader.cpp | 37 |
1 files changed, 2 insertions, 35 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp index 4de3c4f..5c62ef4 100644 --- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp @@ -103,7 +103,6 @@ static cl::opt<bool> ExpandConstantExprs( "Expand constant expressions to instructions for testing purposes")); extern cl::opt<bool> UseNewDbgInfoFormat; -extern cl::opt<cl::boolOrDefault> PreserveInputDbgFormat; namespace { @@ -3953,11 +3952,7 @@ Error BitcodeReader::globalCleanup() { for (Function &F : *TheModule) { MDLoader->upgradeDebugIntrinsics(F); Function *NewFn; - // If PreserveInputDbgFormat=true, then we don't know whether we want - // intrinsics or records, and we won't perform any conversions in either - // case, so don't upgrade intrinsics to records. - if (UpgradeIntrinsicFunction( - &F, NewFn, PreserveInputDbgFormat != cl::boolOrDefault::BOU_TRUE)) + if (UpgradeIntrinsicFunction(&F, NewFn)) UpgradedIntrinsics[&F] = NewFn; // Look for functions that rely on old function attribute behavior. UpgradeFunctionAttributes(F); @@ -7002,37 +6997,9 @@ Error BitcodeReader::materialize(GlobalValue *GV) { F->setIsMaterializable(false); // All parsed Functions should load into the debug info format dictated by the - // Module, unless we're attempting to preserve the input debug info format. + // Module. if (SeenDebugIntrinsic && SeenDebugRecord) return error("Mixed debug intrinsics and debug records in bitcode module!"); - if (PreserveInputDbgFormat == cl::boolOrDefault::BOU_TRUE) { - bool SeenAnyDebugInfo = SeenDebugIntrinsic || SeenDebugRecord; - bool NewDbgInfoFormatDesired = - SeenAnyDebugInfo ? SeenDebugRecord : F->getParent()->IsNewDbgInfoFormat; - if (SeenAnyDebugInfo) { - UseNewDbgInfoFormat = SeenDebugRecord; - } - // If the module's debug info format doesn't match the observed input - // format, then set its format now; we don't need to call the conversion - // function because there must be no existing intrinsics to convert. - // Otherwise, just set the format on this function now. - if (NewDbgInfoFormatDesired != F->getParent()->IsNewDbgInfoFormat) - F->getParent()->setNewDbgInfoFormatFlag(NewDbgInfoFormatDesired); - else - F->setNewDbgInfoFormatFlag(NewDbgInfoFormatDesired); - } else { - // If we aren't preserving formats, we use the Module flag to get our - // desired format instead of reading flags, in case we are lazy-loading and - // the format of the module has been changed since it was set by the flags. - // We only need to convert debug info here if we have debug records but - // desire the intrinsic format; everything else is a no-op or handled by the - // autoupgrader. - bool ModuleIsNewDbgInfoFormat = F->getParent()->IsNewDbgInfoFormat; - if (ModuleIsNewDbgInfoFormat || !SeenDebugRecord) - F->setNewDbgInfoFormatFlag(ModuleIsNewDbgInfoFormat); - else - F->setIsNewDbgInfoFormat(ModuleIsNewDbgInfoFormat); - } if (StripDebugInfo) stripDebugInfo(*F); |