Slot 3

How to Write an LLVM Pass
Aaron Smith, Microsoft, United States


This course will provide an introduction to the LLVM open source project ( and how to develop your own LLVM compiler pass. We will develop two passes in the course: a simple dead code elimination pass using the existing LLVM APIs to detect code; and an iterative liveness analysis pass which we will use in place of the LLVM APIs. By the end of this course, you will be familiar with how to build LLVM from source, how to install and use Cmake, a little about Git and how to develop and use your own LLVM compiler pass. This course is appropriate for all levels and no previous knowledge of LLVM or compilers is assumed. Knowledge of C++ is helpful for the lecture material and implementing the passes.

The course has the following lectures:

- Introduction to LLVM (building LLVM, overview of different tools, where to find information)
- Writing an LLVM pass (how passes work, LLVM IR and helpful APIs)
- Simple dead code elimination pass
- Iterative liveness analysis pass


Aaron Smith leads the machine learning compiler team for Microsoft’s FPGA-based AI accelerators and is a Reader in Informatics at the University of Edinburgh where he teaches introductory compilers. He has over 20 years of experience developing advanced optimizing compilers and is an active contributor to the LLVM open source project.

  Back to course info