Skip to content

Commit

Permalink
disable llvm optimizations in JIT when generating output
Browse files Browse the repository at this point in the history
When saving native code we re-run optimization on the whole module
as part of object file emission, so it is not needed for JIT compiled
code. We are already passing -O0 for package precompilation; this
extends that benefit to the system image.
  • Loading branch information
JeffBezanson committed Aug 18, 2016
1 parent adecd73 commit 9f50de4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
9 changes: 8 additions & 1 deletion src/jitlayers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,13 @@ JuliaOJIT::JuliaOJIT(TargetMachine &TM)
}
)
{
addOptimizationPasses(&PM);
if (!jl_generating_output()) {
addOptimizationPasses(&PM);
}
else {
PM.add(createLowerGCFramePass(tbaa_gcframe));
PM.add(createLowerPTLSPass(imaging_mode, tbaa_const));
}
if (TM.addPassesToEmitMC(PM, Ctx, ObjStream))
llvm_unreachable("Target does not support MC emission.");

Expand Down Expand Up @@ -1038,6 +1044,7 @@ static void jl_gen_llvm_globaldata(llvm::Module *mod, ValueToValueMapTy &VMap,
extern "C"
void jl_dump_native(const char *bc_fname, const char *obj_fname, const char *sysimg_data, size_t sysimg_len)
{
JL_TIMING(NATIVE_DUMP);
assert(imaging_mode);
// We don't want to use MCJIT's target machine because
// it uses the large code model and we may potentially
Expand Down
3 changes: 2 additions & 1 deletion src/timing.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ static inline uint64_t rdtscp(void)
X(AST_COMPRESS), \
X(AST_UNCOMPRESS), \
X(SYSIMG_LOAD), \
X(SYSIMG_DUMP),
X(SYSIMG_DUMP), \
X(NATIVE_DUMP),

enum jl_timing_owners {
#define X(name) JL_TIMING_ ## name
Expand Down

0 comments on commit 9f50de4

Please sign in to comment.