Chapter 5. Implementing Optimizations

In this chapter, we will cover the following recipes:

  • Writing a dead code elimination pass
  • Writing an inlining transformation pass
  • Writing a pass for memory optimization
  • Combining LLVM IR
  • Transforming and optimizing loops
  • Reassociating expressions
  • Vectorizing IR
  • Other optimization passes

Introduction

In the previous chapter, we saw how to write a pass in LLVM. We also demonstrated writing a few analysis passes with an example of alias analysis. Those passes just read the source code and gave us information about it. In this chapter, we will go further and write transformation passes that will actually change the source code, trying to optimize it for the faster execution of code. In the first two recipes, we will show you how a transformation pass is written and how it changes the code. After that, we will see how we can make changes in the code of passes to tinker with the behavior of the passes.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.14.145.82