diff --git a/interpreter/cling/lib/Interpreter/CIFactory.cpp b/interpreter/cling/lib/Interpreter/CIFactory.cpp index 052895b6b1ce7..84d0caf8f813d 100644 --- a/interpreter/cling/lib/Interpreter/CIFactory.cpp +++ b/interpreter/cling/lib/Interpreter/CIFactory.cpp @@ -1133,7 +1133,10 @@ static void stringifyPreprocSetting(PreprocessorOptions& PPOpts, CGOpts.CXXCtorDtorAliases = 1; #endif // Reduce amount of emitted symbols by optimizing more. - CGOpts.OptimizationLevel = 2; + // FIXME: We have a bug when we switch to -O2, for some cases it takes + // several minutes to optimize, while the same code compiled by clang -O2 + // takes only a few seconds. + CGOpts.OptimizationLevel = 0; // Taken from a -O2 run of clang: CGOpts.DiscardValueNames = 1; CGOpts.OmitLeafFramePointer = 1; diff --git a/interpreter/cling/test/Pragmas/opt.C b/interpreter/cling/test/Pragmas/opt.C index 14660619ea099..ea1f0d4b6b813 100644 --- a/interpreter/cling/test/Pragmas/opt.C +++ b/interpreter/cling/test/Pragmas/opt.C @@ -13,10 +13,10 @@ extern "C" int printf(const char*,...); #include "cling/Interpreter/Transaction.h" gCling->getDefaultOptLevel() -// CHECK: (int) 2 +// CHECK: (int) 0 (int)gCling->getLatestTransaction()->getCompilationOpts().OptLevel -// CHECK-NEXT: (int) 2 +// CHECK-NEXT: (int) 0 { #pragma cling optimize(0) diff --git a/interpreter/cling/test/Prompt/MetaProcessor/DotO.C b/interpreter/cling/test/Prompt/MetaProcessor/DotO.C index d7ffe2833c764..656c9d7eeae9d 100644 --- a/interpreter/cling/test/Prompt/MetaProcessor/DotO.C +++ b/interpreter/cling/test/Prompt/MetaProcessor/DotO.C @@ -12,13 +12,13 @@ extern "C" int printf(const char*,...); #include "cling/Interpreter/Interpreter.h" #include "cling/Interpreter/Transaction.h" -gCling->getDefaultOptLevel() // CHECK: (int) 2 -.O // CHECK-NEXT: Current cling optimization level: 2 -(int)gCling->getLatestTransaction()->getCompilationOpts().OptLevel // CHECK-NEXT: (int) 2 - -.O 0 gCling->getDefaultOptLevel() // CHECK: (int) 0 .O // CHECK-NEXT: Current cling optimization level: 0 +(int)gCling->getLatestTransaction()->getCompilationOpts().OptLevel // CHECK-NEXT: (int) 2 + +.O 2 +gCling->getDefaultOptLevel() // CHECK: (int) 2 +.O // CHECK-NEXT: Current cling optimization level: 2 #pragma cling optimize(1) gCling->getDefaultOptLevel() // CHECK: (int) 0