Add loop related optimizations to LLVM JIT#16436
Conversation
mono/mini/llvm-jit.cpp
Outdated
| // FIXME: find optimal mono specific order of passes | ||
| // see https://llvm.org/docs/Frontend/PerformanceTips.html#pass-ordering | ||
| opts = " -simplifycfg -sroa -instcombine -gvn"; | ||
| opts = " -simplifycfg -sroa -early-cse -instcombine -correlated-propagation -instcombine -loop-simplify -lcssa -loop-rotate -licm -instcombine -lcssa -indvars -loop-deletion -instcombine -simplifycfg"; |
There was a problem hiding this comment.
Nit: simplifycfg is there twice
There was a problem hiding this comment.
@filipnavara the last -simplifycfg removes a redundant block generated by previous pass (instcombine). The first -simplifycfg removes redundant blocks generated by mono 🙂
There was a problem hiding this comment.
@EgorBo Maybe it's worth adding a comment in the code so nobody removes them in the future?
|
It seems we should also add the |
|
@monojenkins build failed |
|
I am not 100% in this set yet, need to run the benchmarks and diffs one more time to make sure it doesn't regress anything. (however some passes are indeed should be added) |
|
Looks like this needs a conflict resolved |
|
@EgorBo what is the plan with this PR? |
|
@marek-safar yeah will update it soon, this one have two mistakes: |
|
Checking in again. |
|
Just updated the pass list. Benchmarks (the new pass order is a baseline): (benchmarks: https://github.com/nxrighthere/BurstBenchmarks)
|
# Conflicts: # mono/mini/llvm-jit.cpp
|
@monojenkins build failed |
* Add loop-related optimizations * Update llvm-jit.cpp * Update llvm-jit.cpp * Update llvm-jit.cpp Commit migrated from mono/mono@8f85967


Example:
Before my change:
LLVM IR:
ASM:
After my change:
LLVM IR:
ASM:
I spent some time analyzing the "Before/After" diffs generated by
opt -O1for our IR: https://godbolt.org/z/vRCpS3 in order to compose this set.Some
dotnet/performancebenchmarks use such loops (with a constant)Diffs:
-simplifycfgdiff-sroa(no changes)-early-cse(no changes)-instcombinediff-correlated-propagationdiff-instcombinediff-loop-simplify(no changes)-lcssadiff-loop-rotatediff-licmdiff-instcombinediff-lcssadiff-indvarsdiff-loop-deletiondiff-instcombinediff(
TODO: add-simplifycfgat the end to remove that redundant BB0 after previous pass) - diff