[LLVMdev] Missing optimizations (again -> pass ordering)
Carl-Philip Hänsch
cphaensch at gmail.com
Mon Aug 18 13:11:10 PDT 2014
Hi,
I'm here again with an other issue with pass ordering:
Take a look at the following code.
#include <stdio.h>
#include <functional>
int main() {
std::function<void(const char*)> hello = [](const char
*name){printf("Hello %s\n", name);};
hello("World");
return 0;
}
When I compile it with -O3 the optimizer does not recognize all
optimizations. Instead I get 143 lines of complicated landing pad code,
allocas etc..
When I put this code into an other opt -O3 process, I get much better code:
23 lines of code where the main function simply consists of a single printf
call. (1 line) -> optimal code that I would write in C.
So, when using sophisticated stl data structures like std::function,
std::vector, std::string, they are not molten down to their C equivalents
until the optimizer runs twice, there is something wrong with pass
ordering. Existing passes are okay, but they are not called often enough to
remove all overhead. I hope there will be further work on rerunning passes.
Cheers
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140818/f09d5d6b/attachment.html>
More information about the llvm-dev
mailing list