LLVM doesn&#x27;t ever even bother with rewrite rules. That&#x27;s done substantially earlier in the compiler, at the Core phase (rewrite rules are &#x27;just&#x27; equational reasoning optimizations that the compiler is aware of, so it works roughly at the level of the program you write, vs any more complicated intermediate form.)<p>There is still some inlining&#x2F;smarts going on at the LLVM level, obviously, but it&#x27;s nowhere near as aggressive as it is at the Core level in GHC. And obviously rewrite rules are user-definable - so they kick in much earlier. (As a side note, we actually spit out pretty optimized LLVM code from the C-- backend, in such a way that only some of LLVM&#x27;s heaviest optimizations make a difference).<p>There are some specific optimizations that are simply not possible for LLVM in the general case and are better handled before conversion (for example, C-- at one point essentially gets CPS transformed in a way which LLVM cannot &#x27;see through&#x27;, and by that point you&#x27;ve lost the opportunity to do a number of simpler optimizations like basic constant propagation, while it&#x27;s trivial to do earlier). But that&#x27;s mostly the same in any compiler, and not unique to GHC...