I found that when implementing textbook compiler optimizations, some of them tended to override the improvements made by other optimizations. This entailed a lot of work, trying to find the right balance between them.
Thus, there really is no good answer to your question. All this is a compromise. Many optimizations work well on one type of code, but are pessimizations for other types. This is similar to designing a house - if you make the kitchen larger, the pantry will become smaller.
The real job of creating an optimizer is trying out various combinations, comparing the results and, like a chef, choosing the right combination of ingredients.
source
share