This should be all the logic. Before reviewing the style/code appeareance, I'd like to ensure that this is the right direction, thanks.
Left to be done:
- There are two tests failing, the one which include inline asm (currently investigating).
- The old LTO code wasn't removed yet. I found that it makes the patch less readable, and that can be removed separately.
Why don't you keep the old interface and replace only the content of LTO.cpp? I think that was a good separation.