Open davezarzycki opened 6 years ago
That would certainly help. That being said, lots of projects don't profile for various reasons.
Personally, I think the best bang-for-buck solution is to have two default optimization levels: one for obvious loops and one for everything else. This would also work well with things like code alignment (where loops are aligned but everything else is unaligned for density reasons).
Do you think Hot cold splitting maybe helpful in this case?
Extended Description
This bug is a followup to discussion in: https://reviews.llvm.org/D43201
It would be great if the compiler could conditionalize code gen based on the hot/cold nature of functions and/or basic blocks. Anecdotally speaking (from my experience at Apple), improving overall code density tends to improve overall system performance. That being said, microbenchmarks sometimes suffer.
It would be great if LLVM could optimize for "reasonable size" (i.e. not micro-coded; a.k.a. -Os not -Oz) by default and then switch to throughput optimized code gen when evidence suggests that a "hot path" exists. At best, evidence can include profile guided optimization and explicit source attributes; and at worst simple heuristics.