how to understand instruction reordering has no effect on single thread, it will not affect the running result of the program, but it will affect multi-thread.
for example:
int i = 0; //1
i = i + 1; //2
System.out.println(i); //3
if reordering is performed and the order of execution of 2 and 3 is changed, it will definitely affect the result of the run.