[cfe-dev] Calling main() is ub based optimizations

Piotr Padlewski via cfe-dev cfe-dev at lists.llvm.org
Sat Nov 12 01:58:02 PST 2016


Hey,
I have question. Does clang take advantage of the fact that calling main or
taking address of main function in C++ is undefined behavior?
I've heard that some compilers do so and AFAIRC I've heard that it was
important to some benchmarks.
I guess compiler can assume the values of globals after calling main,
because it knows that it is the first function called after initializing
them.

Is there any optimization that do this in clang?

Piotr
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20161112/db02666e/attachment.html>


More information about the cfe-dev mailing list