Skip to content

Conversation

@nikic
Copy link
Contributor

@nikic nikic commented Oct 31, 2025

save-temps is debugging functionality, so it should preserve use-lists to keep the optimization/codegen behavior of the dumped bitcode as close to the in-memory IR as possible.

save-temps is debugging functionality, so it should preserve
use-lists to keep the optimization/codegen behavior of the dumped
bitcode as close to the in-memory IR as possible.
@nikic nikic requested a review from teresajohnson October 31, 2025 16:30
@llvmbot llvmbot added the LTO Link time optimization (regular/full LTO or ThinLTO) label Oct 31, 2025
@llvmbot
Copy link
Member

llvmbot commented Oct 31, 2025

@llvm/pr-subscribers-lto

Author: Nikita Popov (nikic)

Changes

save-temps is debugging functionality, so it should preserve use-lists to keep the optimization/codegen behavior of the dumped bitcode as close to the in-memory IR as possible.


Full diff: https://github.com/llvm/llvm-project/pull/165882.diff

1 Files Affected:

  • (modified) llvm/lib/LTO/LTOBackend.cpp (+1-1)
diff --git a/llvm/lib/LTO/LTOBackend.cpp b/llvm/lib/LTO/LTOBackend.cpp
index 93118becedbac..8efde8efb3cb1 100644
--- a/llvm/lib/LTO/LTOBackend.cpp
+++ b/llvm/lib/LTO/LTOBackend.cpp
@@ -124,7 +124,7 @@ Error Config::addSaveTemps(std::string OutputFileName, bool UseInputModulePath,
       // directly and exit.
       if (EC)
         reportOpenError(Path, EC.message());
-      WriteBitcodeToFile(M, OS, /*ShouldPreserveUseListOrder=*/false);
+      WriteBitcodeToFile(M, OS, /*ShouldPreserveUseListOrder=*/true);
       return true;
     };
   };

Copy link
Contributor

@teresajohnson teresajohnson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks can you add a test?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

LTO Link time optimization (regular/full LTO or ThinLTO)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants