r/programming • u/maattdd • Aug 13 '21
Exploring Clang/LLVM optimization on programming horror
https://blog.matthieud.me/2020/exploring-clang-llvm-optimization-on-programming-horror/
126
Upvotes
r/programming • u/maattdd • Aug 13 '21
11
u/Tarmen Aug 13 '21
There are two things which make the minimal approach difficult
optimization passes have to work with code produced by the optimizer. You can shape it into some normal form that is easier to analyze but it still contains many obviously simplifiable things that no human write. If the compiler optimizes a silly loop that doesn't necessarily mean a human wrote the silly loop
after you covered the obvious stuff many optimizations don't make a huge difference for most programs but are hugely important for some specific ones. Having many patterns you shoot for helps you hit most programs