[llvm] r182611 - The command line options need to be processed before we create the TargetMachine.
Bill Wendling
isanbard at gmail.com
Thu May 23 14:21:50 PDT 2013
Author: void
Date: Thu May 23 16:21:50 2013
New Revision: 182611
URL: http://llvm.org/viewvc/llvm-project?rev=182611&view=rev
Log:
The command line options need to be processed before we create the TargetMachine.
Move the processing of the command line options to right before we create the
TargetMachine instead of after.
<rdar://problem/13468287>
Modified:
llvm/trunk/tools/lto/LTOCodeGenerator.cpp
Modified: llvm/trunk/tools/lto/LTOCodeGenerator.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/LTOCodeGenerator.cpp?rev=182611&r1=182610&r2=182611&view=diff
==============================================================================
--- llvm/trunk/tools/lto/LTOCodeGenerator.cpp (original)
+++ llvm/trunk/tools/lto/LTOCodeGenerator.cpp Thu May 23 16:21:50 2013
@@ -220,10 +220,15 @@ const void* LTOCodeGenerator::compile(si
return _nativeObjectFile->getBufferStart();
}
-bool LTOCodeGenerator::determineTarget(std::string& errMsg) {
+bool LTOCodeGenerator::determineTarget(std::string &errMsg) {
if (_target != NULL)
return false;
+ // if options were requested, set them
+ if (!_codegenOptions.empty())
+ cl::ParseCommandLineOptions(_codegenOptions.size(),
+ const_cast<char **>(&_codegenOptions[0]));
+
std::string TripleStr = _linker.getModule()->getTargetTriple();
if (TripleStr.empty())
TripleStr = sys::getDefaultTargetTriple();
@@ -361,12 +366,7 @@ bool LTOCodeGenerator::generateObjectFil
Module* mergedModule = _linker.getModule();
- // if options were requested, set them
- if (!_codegenOptions.empty())
- cl::ParseCommandLineOptions(_codegenOptions.size(),
- const_cast<char **>(&_codegenOptions[0]));
-
- // mark which symbols can not be internalized
+ // Mark which symbols can not be internalized
this->applyScopeRestrictions();
// Instantiate the pass manager to organize the passes.
@@ -382,12 +382,11 @@ bool LTOCodeGenerator::generateObjectFil
// Enabling internalize here would use its AllButMain variant. It
// keeps only main if it exists and does nothing for libraries. Instead
// we create the pass ourselves with the symbol list provided by the linker.
- if (!DisableOpt) {
+ if (!DisableOpt)
PassManagerBuilder().populateLTOPassManager(passes,
/*Internalize=*/false,
!DisableInline,
DisableGVNLoadPRE);
- }
// Make sure everything is still good.
passes.add(createVerifierPass());
More information about the llvm-commits
mailing list