aboutsummaryrefslogtreecommitdiff
path: root/tools/lto/lto.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/lto/lto.cpp')
-rw-r--r--tools/lto/lto.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/tools/lto/lto.cpp b/tools/lto/lto.cpp
index a1dd4ebbccba..1b218a64cbf5 100644
--- a/tools/lto/lto.cpp
+++ b/tools/lto/lto.cpp
@@ -44,9 +44,13 @@ static cl::opt<bool>
DisableGVNLoadPRE("disable-gvn-loadpre", cl::init(false),
cl::desc("Do not run the GVN load PRE pass"));
-static cl::opt<bool>
-DisableLTOVectorization("disable-lto-vectorization", cl::init(false),
- cl::desc("Do not run loop or slp vectorization during LTO"));
+static cl::opt<bool> DisableLTOVectorization(
+ "disable-lto-vectorization", cl::init(false),
+ cl::desc("Do not run loop or slp vectorization during LTO"));
+
+static cl::opt<bool> EnableFreestanding(
+ "lto-freestanding", cl::init(false),
+ cl::desc("Enable Freestanding (disable builtins / TLI) during LTO"));
#ifdef NDEBUG
static bool VerifyByDefault = false;
@@ -159,6 +163,7 @@ static void lto_add_attrs(lto_code_gen_t cg) {
if (OptLevel < '0' || OptLevel > '3')
report_fatal_error("Optimization level must be between 0 and 3");
CG->setOptLevel(OptLevel - '0');
+ CG->setFreestanding(EnableFreestanding);
}
extern const char* lto_get_version() {
@@ -267,7 +272,7 @@ lto_module_t lto_module_create_in_local_context(const void *mem, size_t length,
lto_initialize();
llvm::TargetOptions Options = InitTargetOptionsFromCodeGenFlags();
- // Create a local context. Ownership will be transfered to LTOModule.
+ // Create a local context. Ownership will be transferred to LTOModule.
std::unique_ptr<LLVMContext> Context = llvm::make_unique<LLVMContext>();
Context->setDiagnosticHandler(diagnosticHandler, nullptr, true);
@@ -464,6 +469,7 @@ thinlto_code_gen_t thinlto_create_codegen(void) {
lto_initialize();
ThinLTOCodeGenerator *CodeGen = new ThinLTOCodeGenerator();
CodeGen->setTargetOptions(InitTargetOptionsFromCodeGenFlags());
+ CodeGen->setFreestanding(EnableFreestanding);
if (OptLevel.getNumOccurrences()) {
if (OptLevel < '0' || OptLevel > '3')