Loop coalescing: fix pointer chainsing in use-chain traversal
Loop coalescing: fix pointer chainsing in use-chain traversal

In the replaceAllUsesExcept utility function called from loop coalescing the
iteration over the use-chain is incorrect. The use list nodes (IROperands) have
next/prev links, and bluntly resetting the use would make the loop to continue
on uses of the value that was replaced instead of the original one. As a
result, it could miss the existing uses and update the wrong ones. Make sure we
increment the iterator before updating the use in the loop body.

Reported-by: Uday Bondhugula <uday@polymagelabs.com>

Closes #291.

PiperOrigin-RevId: 283754195
Change-Id: Ia9478e50544b2cd30b42e18262e3038009cf05b3

xzturn/tensorflow,aam-at/tensorflow,tensorflow/tensorflow,frreiss/tensorflow-fred,sarvex/tensorflow,yongtang/tensorflow,sarvex/tensorflow,karllessard/tensorflow,petewarden/tensorflow,paolodedios/tensorflow,tensorflow/tensorflow-pywrap_saved_model,sarvex/tensorflow,karllessard/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,xzturn/tensorflow,paolodedios/tensorflow,gunan/tensorflow,gunan/tensorflow,gunan/tensorflow,freedomtan/tensorflow,aldian/tensorflow,jhseu/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,tensorflow/tensorflow-experimental_link_static_libraries_once,yongtang/tensorflow,cxxgtxy/tensorflow,paolodedios/tensorflow,Intel-Corporation/tensorflow,gunan/tensorflow,gautam1858/tensorflow,Intel-Corporation/tensorflow,aam-at/tensorflow,freedomtan/tensorflow,jhseu/tensorflow,Intel-Corporation/tensorflow,davidzchen/tensorflow,jhseu/tensorflow,davidzchen/tensorflow,Intel-Corporation/tensorflow,tensorflow/tensorflow,tensorflow/tensorflow-pywrap_saved_model,Intel-tensorflow/tensorflow,gunan/tensorflow,Intel-tensorflow/tensorflow,gautam1858/tensorflow,xzturn/tensorflow,gautam1858/tensorflow,jhseu/tensorflow,Intel-tensorflow/tensorflow,annarev/tensorflow,aldian/tensorflow,frreiss/tensorflow-fred,tensorflow/tensorflow,aam-at/tensorflow,frreiss/tensorflow-fred,xzturn/tensorflow,frreiss/tensorflow-fred,paolodedios/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,karllessard/tensorflow,gunan/tensorflow,yongtang/tensorflow,cxxgtxy/tensorflow,davidzchen/tensorflow,gautam1858/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,Intel-tensorflow/tensorflow,yongtang/tensorflow,renyi533/tensorflow,renyi533/tensorflow,karllessard/tensorflow,Intel-tensorflow/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,jhseu/tensorflow,petewarden/tensorflow,sarvex/tensorflow,jhseu/tensorflow,annarev/tensorflow,petewarden/tensorflow,renyi533/tensorflow,renyi533/tensorflow,gunan/tensorflow,davidzchen/tensorflow,freedomtan/tensorflow,paolodedios/tensorflow,Intel-tensorflow/tensorflow,aldian/tensorflow,tensorflow/tensorflow,tensorflow/tensorflow-pywrap_saved_model,davidzchen/tensorflow,tensorflow/tensorflow,annarev/tensorflow,aam-at/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,frreiss/tensorflow-fred,tensorflow/tensorflow-experimental_link_static_libraries_once,tensorflow/tensorflow-pywrap_saved_model,aam-at/tensorflow,jhseu/tensorflow,Intel-Corporation/tensorflow,renyi533/tensorflow,tensorflow/tensorflow,petewarden/tensorflow,tensorflow/tensorflow-pywrap_saved_model,Intel-tensorflow/tensorflow,sarvex/tensorflow,gunan/tensorflow,Intel-Corporation/tensorflow,petewarden/tensorflow,tensorflow/tensorflow-pywrap_saved_model,paolodedios/tensorflow,frreiss/tensorflow-fred,aam-at/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,renyi533/tensorflow,sarvex/tensorflow,frreiss/tensorflow-fred,gautam1858/tensorflow,jhseu/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,gautam1858/tensorflow,freedomtan/tensorflow,yongtang/tensorflow,tensorflow/tensorflow,gautam1858/tensorflow,Intel-tensorflow/tensorflow,frreiss/tensorflow-fred,Intel-tensorflow/tensorflow,petewarden/tensorflow,frreiss/tensorflow-fred,sarvex/tensorflow,aldian/tensorflow,gautam1858/tensorflow,gautam1858/tensorflow,freedomtan/tensorflow,freedomtan/tensorflow,gautam1858/tensorflow,jhseu/tensorflow,jhseu/tensorflow,freedomtan/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,tensorflow/tensorflow-pywrap_saved_model,freedomtan/tensorflow,xzturn/tensorflow,xzturn/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,aldian/tensorflow,karllessard/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,cxxgtxy/tensorflow,Intel-tensorflow/tensorflow,cxxgtxy/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,tensorflow/tensorflow-experimental_link_static_libraries_once,renyi533/tensorflow,renyi533/tensorflow,tensorflow/tensorflow,davidzchen/tensorflow,Intel-Corporation/tensorflow,petewarden/tensorflow,karllessard/tensorflow,tensorflow/tensorflow,karllessard/tensorflow,annarev/tensorflow,tensorflow/tensorflow-pywrap_saved_model,karllessard/tensorflow,sarvex/tensorflow,aldian/tensorflow,davidzchen/tensorflow,Intel-Corporation/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,davidzchen/tensorflow,renyi533/tensorflow,annarev/tensorflow,cxxgtxy/tensorflow,freedomtan/tensorflow,aam-at/tensorflow,yongtang/tensorflow,Intel-tensorflow/tensorflow,aldian/tensorflow,aam-at/tensorflow,davidzchen/tensorflow,frreiss/tensorflow-fred,cxxgtxy/tensorflow,paolodedios/tensorflow,tensorflow/tensorflow-pywrap_saved_model,paolodedios/tensorflow,xzturn/tensorflow,annarev/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,gunan/tensorflow,annarev/tensorflow,xzturn/tensorflow,paolodedios/tensorflow,freedomtan/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,aam-at/tensorflow,gautam1858/tensorflow,frreiss/tensorflow-fred,gunan/tensorflow,jhseu/tensorflow,xzturn/tensorflow,petewarden/tensorflow,gunan/tensorflow,yongtang/tensorflow,petewarden/tensorflow,petewarden/tensorflow,xzturn/tensorflow,cxxgtxy/tensorflow,davidzchen/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,aam-at/tensorflow,yongtang/tensorflow,renyi533/tensorflow,yongtang/tensorflow,annarev/tensorflow,xzturn/tensorflow,tensorflow/tensorflow-pywrap_saved_model,yongtang/tensorflow,annarev/tensorflow,xzturn/tensorflow,davidzchen/tensorflow,paolodedios/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,karllessard/tensorflow,yongtang/tensorflow,gunan/tensorflow,karllessard/tensorflow,jhseu/tensorflow,tensorflow/tensorflow,petewarden/tensorflow,renyi533/tensorflow,paolodedios/tensorflow,cxxgtxy/tensorflow,karllessard/tensorflow,annarev/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,gautam1858/tensorflow,aam-at/tensorflow,davidzchen/tensorflow,tensorflow/tensorflow,aldian/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,renyi533/tensorflow,annarev/tensorflow,frreiss/tensorflow-fred,tensorflow/tensorflow-pywrap_saved_model,aam-at/tensorflow,freedomtan/tensorflow,freedomtan/tensorflow,petewarden/tensorflow