aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/Function.cpp
diff options
context:
space:
mode:
authorStephen Tozer <stephen.tozer@sony.com>2024-04-05 14:18:59 +0100
committerGitHub <noreply@github.com>2024-04-05 14:18:59 +0100
commit379628d446e5e6a043ead15fd29451f06fe3e100 (patch)
tree5f009f22eb83029f906ce7738052fa86338e6d79 /llvm/lib/IR/Function.cpp
parent6d2f57d2c4053af8f0c730bbfed141949149604c (diff)
downloadllvm-379628d446e5e6a043ead15fd29451f06fe3e100.zip
llvm-379628d446e5e6a043ead15fd29451f06fe3e100.tar.gz
llvm-379628d446e5e6a043ead15fd29451f06fe3e100.tar.bz2
[RemoveDIs] Add flag to preserve the debug info format of input IR (#87379)
This patch adds a new flag: `--preserve-input-debuginfo-format` This flag instructs the tool to not convert the debug info format (intrinsics/records) of input IR, but to instead determine the format of the input IR and overwrite the other format-determining flags so that we process and output the file in the same format that we received it in. This flag is turned off by llvm-link, llvm-lto, and llvm-lto2, and should be turned off by any other tool that expects to parse multiple IR modules and have their debug info formats match. The motivation for this flag is to allow tools to not convert the debug info format - verify-uselistorder and llvm-reduce, and any downstream tools that seek to test or mutate IR as-is, without applying extraneous modifications to the input. This is a necessary step to using debug records by default in all (other) LLVM tools.
Diffstat (limited to 'llvm/lib/IR/Function.cpp')
-rw-r--r--llvm/lib/IR/Function.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/IR/Function.cpp b/llvm/lib/IR/Function.cpp
index eb126f1..b5fda9b 100644
--- a/llvm/lib/IR/Function.cpp
+++ b/llvm/lib/IR/Function.cpp
@@ -103,6 +103,12 @@ void Function::setIsNewDbgInfoFormat(bool NewFlag) {
else if (!NewFlag && IsNewDbgInfoFormat)
convertFromNewDbgValues();
}
+void Function::setNewDbgInfoFormatFlag(bool NewFlag) {
+ for (auto &BB : *this) {
+ BB.setNewDbgInfoFormatFlag(NewFlag);
+ }
+ IsNewDbgInfoFormat = NewFlag;
+}
//===----------------------------------------------------------------------===//
// Argument Implementation