Skip to content

Commit

Permalink
Pass CodeGenOpt::Less to LLVM at O1 (rather than CodeGenOpt::None). (#…
Browse files Browse the repository at this point in the history
…37893)

For context, please see
#35086 (comment).
Regarding alignment with clang, please see
https://reviews.llvm.org/D28409
(/#35086 (comment)).

```
Prior to Julia 1.5, Julia passed CodeGenOpt::Aggressive to LLVM at -O1.
As of Julia 1.5, Julia passes CodeGenOpt::None to LLVM at -O1.

This reduction in optimization effort at -O1 improved compilation latency,
but induced appreciable runtime regressions.

This commit makes Julia pass CodeGenOpt::Less to LLVM at -O1,
mitigating the runtime regressions caused by CodeGenOpt::None,
while retaining most of CodeGenOpt::None's latency improvements.

This commit also aligns Julia's CodeGenOpt selection at -O1
with that of clang.
```

Best! :)
  • Loading branch information
Sacha0 committed May 2, 2024
1 parent 0f77de4 commit c88f4e2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/jitlayers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,8 @@ CodeGenOpt::Level CodeGenOptLevelFor(int optlevel)
#ifdef DISABLE_OPT
return CodeGenOpt::None;
#else
return optlevel < 2 ? CodeGenOpt::None :
return optlevel == 0 ? CodeGenOpt::None :
optlevel == 1 ? CodeGenOpt::Less :
optlevel == 2 ? CodeGenOpt::Default :
CodeGenOpt::Aggressive;
#endif
Expand Down

0 comments on commit c88f4e2

Please sign in to comment.