Why does Clang optimize away the loop in this code
#include #include static size_t const N = 1 << 27; static double arr
x += 0.0 isn't a NOOP if x is -0.0. The optimizer could strip out the whole loop anyway since the results aren't used, though. In general, it's hard to tell why an optimizer makes the decisions it does.
x += 0.0
x