Changeset View
Changeset View
Standalone View
Standalone View
llvm/lib/LTO/LTOCodeGenerator.cpp
Show First 20 Lines • Show All 51 Lines • ▼ Show 20 Lines | |||||
#include "llvm/Support/TargetSelect.h" | #include "llvm/Support/TargetSelect.h" | ||||
#include "llvm/Support/ToolOutputFile.h" | #include "llvm/Support/ToolOutputFile.h" | ||||
#include "llvm/Support/YAMLTraits.h" | #include "llvm/Support/YAMLTraits.h" | ||||
#include "llvm/Support/raw_ostream.h" | #include "llvm/Support/raw_ostream.h" | ||||
#include "llvm/Target/TargetOptions.h" | #include "llvm/Target/TargetOptions.h" | ||||
#include "llvm/Transforms/IPO.h" | #include "llvm/Transforms/IPO.h" | ||||
#include "llvm/Transforms/IPO/Internalize.h" | #include "llvm/Transforms/IPO/Internalize.h" | ||||
#include "llvm/Transforms/IPO/PassManagerBuilder.h" | #include "llvm/Transforms/IPO/PassManagerBuilder.h" | ||||
#include "llvm/Transforms/IPO/WholeProgramDevirt.h" | |||||
#include "llvm/Transforms/ObjCARC.h" | #include "llvm/Transforms/ObjCARC.h" | ||||
#include "llvm/Transforms/Utils/ModuleUtils.h" | #include "llvm/Transforms/Utils/ModuleUtils.h" | ||||
#include <system_error> | #include <system_error> | ||||
using namespace llvm; | using namespace llvm; | ||||
const char* LTOCodeGenerator::getVersionString() { | const char* LTOCodeGenerator::getVersionString() { | ||||
#ifdef LLVM_VERSION_INFO | #ifdef LLVM_VERSION_INFO | ||||
return PACKAGE_NAME " version " PACKAGE_VERSION ", " LLVM_VERSION_INFO; | return PACKAGE_NAME " version " PACKAGE_VERSION ", " LLVM_VERSION_INFO; | ||||
▲ Show 20 Lines • Show All 469 Lines • ▼ Show 20 Lines | bool LTOCodeGenerator::optimize(bool DisableVerify, bool DisableInline, | ||||
// Setup output file to emit statistics. | // Setup output file to emit statistics. | ||||
auto StatsFileOrErr = lto::setupStatsFile(LTOStatsFile); | auto StatsFileOrErr = lto::setupStatsFile(LTOStatsFile); | ||||
if (!StatsFileOrErr) { | if (!StatsFileOrErr) { | ||||
errs() << "Error: " << toString(StatsFileOrErr.takeError()) << "\n"; | errs() << "Error: " << toString(StatsFileOrErr.takeError()) << "\n"; | ||||
report_fatal_error("Can't get an output file for the statistics"); | report_fatal_error("Can't get an output file for the statistics"); | ||||
} | } | ||||
StatsFile = std::move(StatsFileOrErr.get()); | StatsFile = std::move(StatsFileOrErr.get()); | ||||
// Currently there is no support for enabling whole program visibility via a | |||||
// 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. | |||||
updateVCallVisibilityInModule(*MergedModule, | |||||
evgeny777: I'd rather use
```
updateVCallVisibilityInModule(*MergedModule, /*… | |||||
Good idea, changed. tejohnson: Good idea, changed. | |||||
/* WholeProgramVisibilityEnabledInLTO */ false); | |||||
// We always run the verifier once on the merged module, the `DisableVerify` | // We always run the verifier once on the merged module, the `DisableVerify` | ||||
// parameter only applies to subsequent verify. | // parameter only applies to subsequent verify. | ||||
verifyMergedModuleOnce(); | verifyMergedModuleOnce(); | ||||
// Mark which symbols can not be internalized | // Mark which symbols can not be internalized | ||||
this->applyScopeRestrictions(); | this->applyScopeRestrictions(); | ||||
// Instantiate the pass manager to organize the passes. | // Instantiate the pass manager to organize the passes. | ||||
▲ Show 20 Lines • Show All 167 Lines • Show Last 20 Lines |
I'd rather use
and remove default value for second parameter