The funny thing about that optimization clusterfuck is that AMD's FOSS drivers get very close to the proprietary drivers in performance without any hacks.
Instead of millions of lines of code, the user space drivers (where optimizations happen) are more like 100k per major GPU generation (which can span like 10 years) + a few 100k shared between all Mesa drivers.