4 ms·
1) This made me curious. Are any of the compilers in real use nondeterministic? 2) Probably that's not needed? A normal optimizing compiler just inlines the fu
by owl57 7y ago
1) This made me curious. Are any of the compilers in real use nondeterministic?
2) Probably that's not needed? A normal optimizing compiler just inlines the function somewhere new — and boom? Then again, can that really happen with practical contemporary compilers and this exact statement?
- mikeash 7y agoMost compilers are nondeterministic in small ways. For example, it's common to use hash tables that are keyed by pointer address and then iterate over the entries in storage order, so the order in which certain things are emitted will change from run to run. This is why "deterministic builds" are such a big deal, and not just an obvious thing that you get for free. I don't know what the chances are that such a thing could ever translate into good assembly being emitted in one run and bad assembly being emitted in the next.
- Dylan16807 7y agoRegister allocation can be quite tricky, and sometimes it can only explore a small part of the problem space, so if you don't start the algorithm with exactly the same seed you might end up with significantly different code in certain functions.