Can the compiler do this automatically and decide whether or not "X=1" can be removed based on if X is a local variable, or if it is possible for a reference to X to "escape" to another thread?
bryu
On that note, I wonder whether optimizations done by compilers such as loop optimizations can change the execution code such that the code actually slows down due to inefficient use of cache.
tmdalsl
In the left version of the code, is it still possible that the output can be "1111111111111..." (no zeros) instead of "111111011111111..."?
Can the compiler do this automatically and decide whether or not "X=1" can be removed based on if X is a local variable, or if it is possible for a reference to X to "escape" to another thread?