[llvm] [RemoveDIs] Print non-intrinsic debug info in textual IR output (PR #79281)
David Blaikie via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 24 08:59:02 PST 2024
================
@@ -75,11 +88,15 @@ PrintFunctionPass::PrintFunctionPass(raw_ostream &OS, const std::string &Banner)
PreservedAnalyses PrintFunctionPass::run(Function &F,
FunctionAnalysisManager &) {
- // RemoveDIs: there's no textual representation of the DPValue debug-info,
- // convert to dbg.values before writing out.
- bool ShouldConvert = F.IsNewDbgInfoFormat;
- if (ShouldConvert)
- F.convertFromNewDbgValues();
+ // RemoveDIs: Regardless of the format we've processed this function in, use
+ // `WriteNewDbgInfoFormat` to determine which format we use to write it.
+ bool ShouldConvert = F.IsNewDbgInfoFormat != WriteNewDbgInfoFormat;
+ if (ShouldConvert) {
+ if (WriteNewDbgInfoFormat)
+ F.convertToNewDbgValues();
+ else
+ F.convertFromNewDbgValues();
+ }
----------------
dwblaikie wrote:
This idiom (& the inverse conversion at the end of the scope) appears in a few places - could it be generalized/refactored into a scoped tool or something to share between the 3-4 places that use it & make them a bit more terse?
https://github.com/llvm/llvm-project/pull/79281
More information about the llvm-commits
mailing list