Turn optimizations on! (Except for full inlining...)

This commit is contained in:
Axel Naumann 2017-03-27 16:18:15 +02:00 committed by sftnight
parent 145e269e5b
commit 3a0bd332e8
2 changed files with 11 additions and 4 deletions

View File

@ -42,7 +42,8 @@ void BackendPasses::CreatePasses(llvm::Module& M)
// DON'T: we will not find our symbols...
//CGOpts_.CXXCtorDtorAliases = 1;
// Default clang -O2 on Linux 64bit also has:
// Default clang -O2 on Linux 64bit also has the following, but see
// CIFactory.cpp.
#if 0
CGOpts_.DisableFPElim = 0;
CGOpts_.DiscardValueNames = 1;
@ -71,9 +72,6 @@ void BackendPasses::CreatePasses(llvm::Module& M)
// Inlining = CGOpts.NoInlining;
}
OptLevel = 0; // we need to keep even "unused" values - until we
// feed incremental modules into the JIT.
llvm::PassManagerBuilder PMBuilder;
PMBuilder.OptLevel = OptLevel;
PMBuilder.SizeLevel = m_CGOpts.OptimizeSize;

View File

@ -934,6 +934,15 @@ static void stringifyPreprocSetting(PreprocessorOptions& PPOpts,
CI->getCodeGenOpts().EmitCodeView = 1;
CI->getCodeGenOpts().CXXCtorDtorAliases = 1;
#endif
// Reduce amount of emitted symbols by optimizing more.
CI->getCodeGenOpts().OptimizationLevel = 2;
// Taken from a -O2 run of clang:
CI->getCodeGenOpts().DiscardValueNames = 1;
CI->getCodeGenOpts().OmitLeafFramePointer = 1;
CI->getCodeGenOpts().UnrollLoops = 1;
CI->getCodeGenOpts().VectorizeLoop = 1;
CI->getCodeGenOpts().VectorizeSLP = 1;
//CI->getCodeGenOpts().setDebugInfo(clang::CodeGenOptions::FullDebugInfo);
// CI->getCodeGenOpts().EmitDeclMetadata = 1; // For unloading, for later
CI->getCodeGenOpts().CXXCtorDtorAliases = 0; // aliasing the complete