4 ms·
Don't most compilers already do this?
by thefreeman 7y ago
Don't most compilers already do this?
- acqq 7y agoSpeaking about C and C++ on Linux, I have an impression that the compilers seldom can decide that the whole functions aren't used, especially because most libraries and programs "export" "everything" by default, so only on run-time it can be decided what will be actually used -- the last linking step happens only when you start the program, by the loader.
- saagarjha 7y agoYeah, isn't this just link-time optimization?
- throwaway542134 7y agoIt's called dead code elimination/optimization and compilers can do it without LTO, with LTO you can can get more savings but ymmv.
- saagarjha 7y agoThe original comment pointed out "entry points", so I assumed that they were talking about libraries rather than standard dead code elimination (which has been a thing for quite some time).