aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/llvm/lib/LTO/LTOCodeGenerator.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm-project/llvm/lib/LTO/LTOCodeGenerator.cpp')
-rw-r--r--contrib/llvm-project/llvm/lib/LTO/LTOCodeGenerator.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/contrib/llvm-project/llvm/lib/LTO/LTOCodeGenerator.cpp b/contrib/llvm-project/llvm/lib/LTO/LTOCodeGenerator.cpp
index 2abf249cbd62..2f7c485b9fc8 100644
--- a/contrib/llvm-project/llvm/lib/LTO/LTOCodeGenerator.cpp
+++ b/contrib/llvm-project/llvm/lib/LTO/LTOCodeGenerator.cpp
@@ -520,6 +520,8 @@ bool LTOCodeGenerator::optimize() {
// linker option in the old LTO API, but this call allows it to be specified
// via the internal option. Must be done before WPD invoked via the optimizer
// pipeline run below.
+ updatePublicTypeTestCalls(*MergedModule,
+ /* WholeProgramVisibilityEnabledInLTO */ false);
updateVCallVisibilityInModule(*MergedModule,
/* WholeProgramVisibilityEnabledInLTO */ false,
// FIXME: This needs linker information via a
@@ -539,6 +541,16 @@ bool LTOCodeGenerator::optimize() {
// Add an appropriate DataLayout instance for this module...
MergedModule->setDataLayout(TargetMach->createDataLayout());
+ if (!SaveIRBeforeOptPath.empty()) {
+ std::error_code EC;
+ raw_fd_ostream OS(SaveIRBeforeOptPath, EC, sys::fs::OF_None);
+ if (EC)
+ report_fatal_error(Twine("Failed to open ") + SaveIRBeforeOptPath +
+ " to save optimized bitcode\n");
+ WriteBitcodeToFile(*MergedModule, OS,
+ /* ShouldPreserveUseListOrder */ true);
+ }
+
ModuleSummaryIndex CombinedIndex(false);
TargetMach = createTargetMachine();
if (!opt(Config, TargetMach.get(), 0, *MergedModule, /*IsThinLTO=*/false,