Graph based data structures in LLVM

Compilers make heavy use of graph data structures as all the code being compiled is essentially stored as a graph. Most compilers also provide ways for visualizing these complex data structures which might come in handy while debugging, and help understanding certain optimizations. Let’s have a look at some of these data structures and how to visualize them using graphviz and LLVM passes. Note: All the graphs we’ll produce are generated in ....

<span title='2023-07-30 23:35:06 +0530 +0530'>July 30, 2023</span>&nbsp;·&nbsp;5 min

Deep diving into LLVM loop unroll

Continuing on the loop optimizations covered in my last post here. Let’s look at one of the key loop optimization in detail today. Loop unroll as the name suggests tries to take the key aspect of a loop out of the loop i.e. looping xD. It achieves so by copying the instructions inside the loop and reducing the number of loop iterations or completely getting rid of them as we will see now....

<span title='2023-05-13 00:58:19 +0530 +0530'>May 13, 2023</span>&nbsp;·&nbsp;16 min

Loop Optimizations in compilers[Part 1]

Introduction Loops are “the” most compute intensive part of any software program making loop optimizations some of the most rewarding optimizations for a compiler. In this post, I’ll try to go over some of these optimizations which are covered by LLVM(I’m sure you’ll find them in other compilers too). This is not an extensive list you can always find more. Loop Invariant Code Motion (Code hoisting) It’s a known coding practice to always keep definitions and constant code outside the loop....

<span title='2023-04-02 01:20:52 +0530 +0530'>April 2, 2023</span>&nbsp;·&nbsp;3 min

Using git worktrees to manage large codebases

As the first blog in the series let’s keep it short and informative. Introduction If you work on a large scale project like compilers you will always come across the need to have multiple versions as a part of your development arsenal. One might be the latest one(in sync with upstream), one might be for a brand new feature you are working on and the other might be some crash issue that you are investigating....

<span title='2023-03-01 00:01:46 +0530 +0530'>March 1, 2023</span>&nbsp;·&nbsp;4 min