Chapter 5. Advanced IR Block Transformations

In the previous chapter, we have gone through some of the optimizations, which were mainly at instruction level. In this chapter, we will look at optimizations on block level where we will be optimizing a block of code to a simpler form, which makes the code more effective. We will start by looking at how loops are represented in LLVM, use the concept of dominance and CFG to optimize loops. We will use Loop Simplification (LoopSimplify)and Loop Invariant Code Motion optimizations for loop processing. We will then see how a scalar value changes during program execution and how the result of this Scalar Evolution Optimization can be used in other optimizations. Then we will look into how LLVM represents ...

Get LLVM Essentials now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.