missed optimizations

It turns out to be pretty easy to use our random program generator to search for missed optimizations by generating highly restricted programs that are equivalent to "return 0" or similar, and then checking that LLVM properly evaporates the code.

The result will be a lot of bug reports like this:

   http://llvm.org/bugs/show_bug.cgi?id=3740

Daniel says this is a boring phase ordering problem but there are also more interesting cases.

Do people care? Should we submit a string of these sorts of reports?

John

Hi John,

My take is "probably not". If there are two or three instruction identities that we are missing, then I'd be interested in adding those, but completely random complex missed optimizations are less interesting to me.

There is an unbounded number of things the optimizer could potentially handle, but we only have a bounded amount of engineering effort. I'd rather drive forward based on actual needs of code observed in the wild.

Just MHO,

-Chris

There is an unbounded number of things the optimizer could potentially
handle, but we only have a bounded amount of engineering effort. I'd
rather drive forward based on actual needs of code observed in the wild.

Fair enough.

The one I submitted, btw, is a safety check for a shift operation, called with constant arguments-- it is almost certainly reasonable to expect that a good compiler at a nontrivial optimization level will make these checks go away.

As a compromise, would you consider adding a "run opt to fixpoint" option to llvm-gcc? Obviously I can do that using a pipeline but in practice the pain of abandoning the simple compilation driver is too much.

John