Re:F() vs. F(void) in C vs. C++
by ndesaulniers on Monday May 13, 2019 @03:16AM
(#19896936)
Great! Thanks for confirming; I suspected LTO would be able to do this optimization as well. I should add that to the post.
I tried enabling link time optimization on clang-8, it does see through and eliminate redundant xor instruction in foo2(). gcc fails to do that, however. I inspect the result by calling objdump on generated object code.