logoalt Hacker News

noriryesterday at 9:59 PM4 repliesview on HN

I don't want an optimizer that eliminates an unnecessary operation. I want a compiler that tells me that it is unnecessary so I can remove it.


Replies

AlotOfReadingyesterday at 10:05 PM

This is operating on IR, not on lines of code. Figuring out where the operation came from is extremely difficult because you have to propagate all of that info back and forth across the passes, and it may end up being split "across" syntactic elements. If your language has any form of metaprogramming or code reuse (i.e. all of them), that operation may also be necessary at some use sites and not at others, among other issues.

maplantyesterday at 11:15 PM

This is not always possible. Consider the monomorphized output of a generic function. An operation may be dead in one instance but not generally

tekknolagiyesterday at 10:11 PM

This kind of compiler/runtime feedback about source code is really interesting and (imo) under-studied. Especially when you take into account something like PGO data.