Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Switch back to O0.
We have a suboptimal behavior in the way cling optimizes code in O2 mode.
Disable it until the issue is understood and fixed.
  • Loading branch information
vgvassilev committed Oct 20, 2017
commit 4b3dd1a31b85e2f3e231cfffc6d2498462da04b4
5 changes: 4 additions & 1 deletion interpreter/cling/lib/Interpreter/CIFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions interpreter/cling/test/Pragmas/opt.C
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
10 changes: 5 additions & 5 deletions interpreter/cling/test/Prompt/MetaProcessor/DotO.C
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down