-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix llvm-kompile-codegen so it optimizes code properly (#1097)
When we migrated the llvm backend optimization pipeline from being applied by `opt` to being applied by `llvm-kompile-codegen`, we made an error. The code generator was not, in fact, applying the `opt` transformation pipeline correctly. This means that `kompile -O2` will not, in fact, apply `llc -O2` to the bitcode generated by the llvm backend, leading to a significant performance regression. While this PR does not entirely fix the issue (an upstream change to the K frontend is also required), it fixes the issue within this repository. We see a roughly 1.5x speedup in runtime when `-O2` is passed to kompile. We do lose something in compilation time, however. This is normal; compiling with optimizations is more expensive, we just weren't doing it correctly before. The main changes in this pull request are threefold: 1. Convert optimizer code to new pass manager. 2. Make sure to run the middle-end optimizer. 3. Convert `TailCallElimination` and `Mem2Reg` from required to optional passes on -O0. In order to make the tail call optimization still work correctly without `TailCallElimination` manually marking tail calls as `tail`, we instead explicitly mark them as `musttail` in the IR generated by the code generator.
- Loading branch information
Dwight Guth
authored
Jul 5, 2024
1 parent
a9393d3
commit 169e15b
Showing
7 changed files
with
83 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters