Get the latest tech news

Optimisation-dependent IR decisions in Clang


I used to naively assume that Clang always handed off the same IR to the LLVM optimisation pipeline regardless of optimisation level. In an attempt to gain a bit more understanding into exactly what kinds of decisions depend on optimisation level in Clang, I surveyed the IR emission code paths.

I was at least aware of the optnone attribute set on functions when compiling at-O0, but I’ve slowly started to notice there are more divergences than just that. In an attempt to gain a bit more understanding into exactly what kinds of decisions depend on optimisation level in Clang, I surveyed the IR emission code paths. I ignored decisions related to specialised language specifics (Objective-C, ARC, HLSL, OpenMP) and ABI details.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of optimisation

optimisation

Photo of Clang

Clang

Related news:

News photo

Clang vs. Clang

News photo

How Clang compiles a function (2018)

News photo

How GCC and Clang handle statically known undefined behaviour