aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Bitcode
diff options
context:
space:
mode:
authorStephen Tozer <stephen.tozer@sony.com>2024-04-22 13:37:06 +0100
committerGitHub <noreply@github.com>2024-04-22 13:37:06 +0100
commit8e45935824a905dec7739ea8c95af5fdf2c0c123 (patch)
treeba150bdfbf6228a8720c9092044835065def72d5 /llvm/lib/Bitcode
parent5597d97e9982d8f87c9226898f90c5875b498f71 (diff)
downloadllvm-8e45935824a905dec7739ea8c95af5fdf2c0c123.zip
llvm-8e45935824a905dec7739ea8c95af5fdf2c0c123.tar.gz
llvm-8e45935824a905dec7739ea8c95af5fdf2c0c123.tar.bz2
[RemoveDIs] Make verify-uselistorder preserve the input debug info format (#87789)
Verify-uselistorder wants to take some input IR and verify that the uselist order is stable after roundtripping to bitcode and assembly. This is disrupted if the file is converted between the new and old debug info formats after parsing - while there's no functional difference, the change to the in-memory representation of the IR modifies the uselist. This patch changes verify-uselistorder to not convert input files between debug info formats by default, preventing changes from being made to the file being checked. In addition, this patch makes it so that when we _do_ print IR in the new debug info format to bitcode or assembly, we delete any lingering debug intrinsic declarations, ensuring that we don't write uselist entries for them.
Diffstat (limited to 'llvm/lib/Bitcode')
-rw-r--r--llvm/lib/Bitcode/Writer/BitcodeWriterPass.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriterPass.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriterPass.cpp
index 4f2486c..5f66e1e 100644
--- a/llvm/lib/Bitcode/Writer/BitcodeWriterPass.cpp
+++ b/llvm/lib/Bitcode/Writer/BitcodeWriterPass.cpp
@@ -23,6 +23,8 @@ extern bool WriteNewDbgInfoFormatToBitcode;
PreservedAnalyses BitcodeWriterPass::run(Module &M, ModuleAnalysisManager &AM) {
ScopedDbgInfoFormatSetter FormatSetter(M, M.IsNewDbgInfoFormat &&
WriteNewDbgInfoFormatToBitcode);
+ if (M.IsNewDbgInfoFormat)
+ M.removeDebugIntrinsicDeclarations();
const ModuleSummaryIndex *Index =
EmitSummaryIndex ? &(AM.getResult<ModuleSummaryIndexAnalysis>(M))
@@ -54,6 +56,8 @@ namespace {
bool runOnModule(Module &M) override {
ScopedDbgInfoFormatSetter FormatSetter(
M, M.IsNewDbgInfoFormat && WriteNewDbgInfoFormatToBitcode);
+ if (M.IsNewDbgInfoFormat)
+ M.removeDebugIntrinsicDeclarations();
WriteBitcodeToFile(M, OS, ShouldPreserveUseListOrder, /*Index=*/nullptr,
/*EmitModuleHash=*/false);