How Clang compiles a function (2018)
blog.regehr.org
blog.regehr.org
Many of memory/load stores will be removed later in the pipeline and changed to registers. That is something for the optimization pipeline. Thats when phi nodes etc. will be insert and come into play.
A nicer and newer approach is to use an intermediate bytecode that lowers to LLVM IR; Swift, GHC, and I'm sure several other examples I haven't thought of do this.
I'd like to see this for C because I think -O0 is a bad debugging experience, eg because system libraries are still optimized, and an interpreter running on a C-like bytecode would be better. Really the only thing -O0 is good for is working around compiler bugs.
How Clang Compiles a Function - https://news.ycombinator.com/item?id=17405594 - June 2018 (16 comments)