How Clang Compiles a Function – Embedded in Academia
I’ve been planning on writing a post about how LLVM optimizes a function, but it seems necessary to first write about how Clang translates C or C++ into LLVM. This is going to be fairly high-level:
rather than looking at Clang’s internals, I’m going to focus on how Clang’s output relates to its input
we’re not going to look at any non-trivial C++ features
We’ll use this small function that I borrowed from these excellent lecture notes on loop optimizations:
bool is_sorted(int *a, int n) {
for (i...
Read more at blog.regehr.org