Mark Mitchell wrote:
Anyhow, I think that a combination of compiler/linker help and programmer help are useful. There are some cases where you can do this automatically, and others where you might need programmer help. Just as -ffast-math is useful, so might -fmerge-functions or __attribute__((mergeable)), even if that resulted in non-standard handling of function pointers.
Maybe combination of -fmerge-functions and __attribute__((unmergeable)) could be better? If programmer decide to use -fmerge-functions, he would only like to mark functions that should not be touched by this optimization. Otherwise, marking only mergeable functions in large project become a trouble.