3 ms·
Indeed, it's compiler implementors, not academics. However, the performance impact of optimizations that take advantage of UB is not known, and is potentially
by roca 7y ago
Indeed, it's compiler implementors, not academics.
However, the performance impact of optimizations that take advantage of UB is not known, and is potentially very large. It would be a very interesting experiment to modify a C/C++ compiler so that every C/C++ program has defined semantics in terms of a simple array-of-bytes abstract machine, and see how much slower the generated code is compared to the regular compiler.
- userbinator 7y agoIt would be a very interesting experiment to modify a C/C++ compiler so that every C/C++ program has defined semantics in terms of a simple array-of-bytes abstract machine, and see how much slower the generated code is compared to the regular compiler. Alternatively, look at compilers like Intel's ICC --- it has historically been one of the best at code generation, yet it's not known for having anywhere near the same level of UB-craziness as Clang (or GCC, to a lesser extent). The same has been my experience with MSVC, at least the earlier versions.
- pcwalton 7y agoOn the contrary, ICC doesn't even implement IEEE 754 correctly by default [1], for performance. This is way more aggressive than GCC or Clang. [1]: https://hal.archives-ouvertes.fr/hal-00128124v5/document https://hal.archives-ouvertes.fr/hal-00128124v5/document
- BeeOnRope 7y agoUh, ICC does some crazy things to get some of its performance, such as making transformations not allowed by the standard (inventing writes), in order to get better vectorization. So in some respects ICC is very aggressive.