Skip to content

Commit 548eca7

Browse files
committed
Turn optimizations on! (Except for full inlining...)
1 parent dc57c41 commit 548eca7

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

interpreter/cling/lib/Interpreter/BackendPasses.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ void BackendPasses::CreatePasses(llvm::Module& M)
4242
// DON'T: we will not find our symbols...
4343
//CGOpts_.CXXCtorDtorAliases = 1;
4444

45-
// Default clang -O2 on Linux 64bit also has:
45+
// Default clang -O2 on Linux 64bit also has the following, but see
46+
// CIFactory.cpp.
4647
#if 0
4748
CGOpts_.DisableFPElim = 0;
4849
CGOpts_.DiscardValueNames = 1;
@@ -71,9 +72,6 @@ void BackendPasses::CreatePasses(llvm::Module& M)
7172
// Inlining = CGOpts.NoInlining;
7273
}
7374

74-
OptLevel = 0; // we need to keep even "unused" values - until we
75-
// feed incremental modules into the JIT.
76-
7775
llvm::PassManagerBuilder PMBuilder;
7876
PMBuilder.OptLevel = OptLevel;
7977
PMBuilder.SizeLevel = m_CGOpts.OptimizeSize;

interpreter/cling/lib/Interpreter/CIFactory.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -934,6 +934,15 @@ static void stringifyPreprocSetting(PreprocessorOptions& PPOpts,
934934
CI->getCodeGenOpts().EmitCodeView = 1;
935935
CI->getCodeGenOpts().CXXCtorDtorAliases = 1;
936936
#endif
937+
// Reduce amount of emitted symbols by optimizing more.
938+
CI->getCodeGenOpts().OptimizationLevel = 2;
939+
// Taken from a -O2 run of clang:
940+
CI->getCodeGenOpts().DiscardValueNames = 1;
941+
CI->getCodeGenOpts().OmitLeafFramePointer = 1;
942+
CI->getCodeGenOpts().UnrollLoops = 1;
943+
CI->getCodeGenOpts().VectorizeLoop = 1;
944+
CI->getCodeGenOpts().VectorizeSLP = 1;
945+
937946
//CI->getCodeGenOpts().setDebugInfo(clang::CodeGenOptions::FullDebugInfo);
938947
// CI->getCodeGenOpts().EmitDeclMetadata = 1; // For unloading, for later
939948
CI->getCodeGenOpts().CXXCtorDtorAliases = 0; // aliasing the complete

0 commit comments

Comments
 (0)