Machine Learning Guided Ordering of Compiler Optimization Passes

This continues the work of GSoC 2020 and 2021.

Developers generally use standard optimization pipelines like -O2 and -O3 to optimize their code. Manually crafted heuristics are used to determine which optimization passes to select and how to order the execution of those passes. However, this process is not tailored for a particular application, or kind of application, as it is designed to perform “reasonably well” for any input.

We want to improve the existing heuristics or replace the heuristics with machine learning-based models so that the LLVM compiler can provide a superior order of the passes customized per application.

The last milestone enabled feature extraction, and started investigating training a policy for selecting a more appropriate pass pipeline.

1 Like


Is this project open for contribution or the contributors have already been chosen. If available for contribution could you please let me know people to contact and the medium to contact.

It’s open, see also The LLVM Compiler Infrastructure Project

We can chat on Slack if you want, and/or join the Friday 8am PST MLGO meeting (details here). Would these work?

@mtrofin yes this works. thank you for the response.

Awesome, see you next Friday!

1 Like

@mtrofin could you please share the slack join link. Also does this meeting have a calendar?

The meeting has a calendar, if you join that group, it will auto-add (re-reading the doc, I realized that’s not quite obvious - fixed)

Re. slack: Slack

1 Like

@mtrofin When I try to join using the slack link I see that my mail id does not have an associated account.

You probably need to create an account.

1 Like

I am very interested in this project. I am a master of computer science, my research currently focuses on code intelligence, so I have some knowledge about deep learning and llvm. This is the open source project I am currently involved in, my contribution temporarily in our private dev repo (my source code will be made public after my paper is submitted): GitHub - CGCL-codes/naturalcc: NaturalCC: An Open-Source Toolkit for Code Intelligence
My github address is: isHuangXin (Xin Huang) · GitHub, and I am very interested in participating in open source projects.

My gmail address is: , Could you please invite me to join the slack channel? thanks :smile:


I’m interested in the topic and would also like to join the discussion to see what I can help out. I’m currently a compiler engineer developing in the RISC-V backend. I also have some experience modifying Loop Optimizations (LoopIdiomRecognize and LoopFlatten).

I don’t have to sign-up to GSoC, just trying to find something interesting :wink:

May you please add me to the slack?
Email (without quote): ‘’

1 Like

I think I need an email to send the invite (@abhishek , same - sorry, not super familiar w Slack)

I am a masters student in computer engineering, and I’m interested to contributing to this project. I have programmed an llvm pass, and a front end to emit LLVM IR.
I have a background of programming iOS apps in Swift and also pitched a language feature few years ago (although it didn’t gain much traction)

I’d like to join the slack channel, my email is


1 Like

Hi @mtrofin. I’m Ajay, a student at the University of Illinois at Urbana-Champaign interested in machine learning and compilers. I’ve actually been working on this very same problem for the last few months with CompilerGym, I’d love to discuss it further.

If this project is still open, could you please invite me to the Slack channel as well? My email is


The project can accommodate multiple contributors, working on different aspects of the problem; the proposal submission phase starts tomorrow (April 4) and ends on April 19 IIRC.

I’m interested in applying ML for improving compiler optimization. I’d love to join the slack channel.My email,


1 Like