[llvm] b3f98df - [RemoveDIs] Load into new debug info format by default in llvm-lto and llvm-lto2 (#86271)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 22 06:52:15 PDT 2024
Author: Orlando Cazalet-Hyams
Date: 2024-03-22T13:52:11Z
New Revision: b3f98dff75469b115e3d4b1f10cbf270c8ee81af
URL: https://github.com/llvm/llvm-project/commit/b3f98dff75469b115e3d4b1f10cbf270c8ee81af
DIFF: https://github.com/llvm/llvm-project/commit/b3f98dff75469b115e3d4b1f10cbf270c8ee81af.diff
LOG: [RemoveDIs] Load into new debug info format by default in llvm-lto and llvm-lto2 (#86271)
Directly load all bitcode into the new debug info format in `llvm-lto`
and `llvm-lto2`. This means that new-mode bitcode no longer round-trips
back to old-mode after parsing, and that old-mode bitcode gets
auto-upgraded to new-mode debug info (which is the current in-memory
default in LLVM).
Added:
Modified:
llvm/lib/LTO/LTO.cpp
llvm/tools/llvm-lto/llvm-lto.cpp
llvm/tools/llvm-lto2/llvm-lto2.cpp
Removed:
################################################################################
diff --git a/llvm/lib/LTO/LTO.cpp b/llvm/lib/LTO/LTO.cpp
index b58418c64a116b..53060df7f503e0 100644
--- a/llvm/lib/LTO/LTO.cpp
+++ b/llvm/lib/LTO/LTO.cpp
@@ -579,7 +579,9 @@ LTO::RegularLTOState::RegularLTOState(unsigned ParallelCodeGenParallelismLevel,
const Config &Conf)
: ParallelCodeGenParallelismLevel(ParallelCodeGenParallelismLevel),
Ctx(Conf), CombinedModule(std::make_unique<Module>("ld-temp.o", Ctx)),
- Mover(std::make_unique<IRMover>(*CombinedModule)) {}
+ Mover(std::make_unique<IRMover>(*CombinedModule)) {
+ CombinedModule->IsNewDbgInfoFormat = UseNewDbgInfoFormat;
+}
LTO::ThinLTOState::ThinLTOState(ThinBackend Backend)
: Backend(Backend), CombinedIndex(/*HaveGVs*/ false) {
diff --git a/llvm/tools/llvm-lto/llvm-lto.cpp b/llvm/tools/llvm-lto/llvm-lto.cpp
index 7943d6952b828d..3c452b650cee1b 100644
--- a/llvm/tools/llvm-lto/llvm-lto.cpp
+++ b/llvm/tools/llvm-lto/llvm-lto.cpp
@@ -270,6 +270,7 @@ static cl::opt<bool> TryUseNewDbgInfoFormat(
cl::init(false), cl::Hidden);
extern cl::opt<bool> UseNewDbgInfoFormat;
+extern cl::opt<cl::boolOrDefault> LoadBitcodeIntoNewDbgInfoFormat;
namespace {
@@ -943,6 +944,9 @@ int main(int argc, char **argv) {
InitLLVM X(argc, argv);
cl::HideUnrelatedOptions({<OCategory, &getColorCategory()});
cl::ParseCommandLineOptions(argc, argv, "llvm LTO linker\n");
+ // Load bitcode into the new debug info format by default.
+ if (LoadBitcodeIntoNewDbgInfoFormat == cl::boolOrDefault::BOU_UNSET)
+ LoadBitcodeIntoNewDbgInfoFormat = cl::boolOrDefault::BOU_TRUE;
// RemoveDIs debug-info transition: tests may request that we /try/ to use the
// new debug-info format.
diff --git a/llvm/tools/llvm-lto2/llvm-lto2.cpp b/llvm/tools/llvm-lto2/llvm-lto2.cpp
index d5de4f6b1a277c..f222d02bd7cea7 100644
--- a/llvm/tools/llvm-lto2/llvm-lto2.cpp
+++ b/llvm/tools/llvm-lto2/llvm-lto2.cpp
@@ -193,6 +193,7 @@ static cl::opt<bool> TryUseNewDbgInfoFormat(
cl::init(false), cl::Hidden);
extern cl::opt<bool> UseNewDbgInfoFormat;
+extern cl::opt<cl::boolOrDefault> LoadBitcodeIntoNewDbgInfoFormat;
static void check(Error E, std::string Msg) {
if (!E)
@@ -228,6 +229,9 @@ static int usage() {
static int run(int argc, char **argv) {
cl::ParseCommandLineOptions(argc, argv, "Resolution-based LTO test harness");
+ // Load bitcode into the new debug info format by default.
+ if (LoadBitcodeIntoNewDbgInfoFormat == cl::boolOrDefault::BOU_UNSET)
+ LoadBitcodeIntoNewDbgInfoFormat = cl::boolOrDefault::BOU_TRUE;
// RemoveDIs debug-info transition: tests may request that we /try/ to use the
// new debug-info format.
More information about the llvm-commits
mailing list