2
为什么Clang优化x * 1.0而不优化x + 0.0?
为什么Clang会优化这段代码中的循环 #include <time.h> #include <stdio.h> static size_t const N = 1 << 27; static double arr[N] = { /* initialize to zero */ }; int main() { clock_t const start = clock(); for (int i = 0; i < N; ++i) { arr[i] *= 1.0; } printf("%u ms\n", (unsigned)(clock() - …