Add a fast path for HloInstruction::ReplaceOperandWith
Add a fast path for HloInstruction::ReplaceOperandWith

The fast path triggers when the new operand is the same as the old one
and avoids the unneccessary shape checking and map lookups

PiperOrigin-RevId: 202287723

meteorcloudy/tensorflow,caisq/tensorflow,ZhangXinNan/tensorflow,jbedorf/tensorflow,yongtang/tensorflow,meteorcloudy/tensorflow,snnn/tensorflow,hfp/tensorflow-xsmm,kobejean/tensorflow,xodus7/tensorflow,gautam1858/tensorflow,hfp/tensorflow-xsmm,karllessard/tensorflow,Intel-tensorflow/tensorflow,jart/tensorflow,hehongliang/tensorflow,gunan/tensorflow,yongtang/tensorflow,chemelnucfin/tensorflow,hehongliang/tensorflow,alsrgv/tensorflow,petewarden/tensorflow,seanli9jan/tensorflow,apark263/tensorflow,alshedivat/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,kobejean/tensorflow,alshedivat/tensorflow,tensorflow/tensorflow-pywrap_saved_model,kevin-coder/tensorflow-fork,aselle/tensorflow,chemelnucfin/tensorflow,alsrgv/tensorflow,ageron/tensorflow,caisq/tensorflow,aam-at/tensorflow,jart/tensorflow,jbedorf/tensorflow,jbedorf/tensorflow,frreiss/tensorflow-fred,paolodedios/tensorflow,asimshankar/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,dongjoon-hyun/tensorflow,chemelnucfin/tensorflow,ZhangXinNan/tensorflow,aam-at/tensorflow,snnn/tensorflow,theflofly/tensorflow,ghchinoy/tensorflow,theflofly/tensorflow,ppwwyyxx/tensorflow,manipopopo/tensorflow,frreiss/tensorflow-fred,brchiu/tensorflow,jart/tensorflow,jendap/tensorflow,AnishShah/tensorflow,manipopopo/tensorflow,ghchinoy/tensorflow,jart/tensorflow,frreiss/tensorflow-fred,cxxgtxy/tensorflow,xzturn/tensorflow,hfp/tensorflow-xsmm,annarev/tensorflow,aselle/tensorflow,sarvex/tensorflow,theflofly/tensorflow,davidzchen/tensorflow,cxxgtxy/tensorflow,petewarden/tensorflow,gautam1858/tensorflow,manipopopo/tensorflow,Intel-tensorflow/tensorflow,jart/tensorflow,aam-at/tensorflow,karllessard/tensorflow,aam-at/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,arborh/tensorflow,ZhangXinNan/tensorflow,petewarden/tensorflow,kevin-coder/tensorflow-fork,alsrgv/tensorflow,adit-chandra/tensorflow,manipopopo/tensorflow,adit-chandra/tensorflow,brchiu/tensorflow,chemelnucfin/tensorflow,davidzchen/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,seanli9jan/tensorflow,ageron/tensorflow,alsrgv/tensorflow,asimshankar/tensorflow,sarvex/tensorflow,DavidNorman/tensorflow,caisq/tensorflow,tensorflow/tensorflow-pywrap_saved_model,tensorflow/tensorflow-experimental_link_static_libraries_once,petewarden/tensorflow,gunan/tensorflow,caisq/tensorflow,Intel-Corporation/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,girving/tensorflow,brchiu/tensorflow,meteorcloudy/tensorflow,adit-chandra/tensorflow,xzturn/tensorflow,Bismarrck/tensorflow,kevin-coder/tensorflow-fork,gautam1858/tensorflow,Intel-tensorflow/tensorflow,DavidNorman/tensorflow,sarvex/tensorflow,drpngx/tensorflow,paolodedios/tensorflow,dancingdan/tensorflow,petewarden/tensorflow,gautam1858/tensorflow,Intel-tensorflow/tensorflow,alsrgv/tensorflow,freedomtan/tensorflow,AnishShah/tensorflow,brchiu/tensorflow,ghchinoy/tensorflow,aselle/tensorflow,jalexvig/tensorflow,AnishShah/tensorflow,arborh/tensorflow,ageron/tensorflow,tensorflow/tensorflow-pywrap_saved_model,kevin-coder/tensorflow-fork,Intel-Corporation/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,davidzchen/tensorflow,jalexvig/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,jalexvig/tensorflow,tensorflow/tensorflow,girving/tensorflow,aselle/tensorflow,ghchinoy/tensorflow,frreiss/tensorflow-fred,kobejean/tensorflow,kevin-coder/tensorflow-fork,ghchinoy/tensorflow,chemelnucfin/tensorflow,apark263/tensorflow,asimshankar/tensorflow,frreiss/tensorflow-fred,ghchinoy/tensorflow,kobejean/tensorflow,freedomtan/tensorflow,renyi533/tensorflow,jhseu/tensorflow,karllessard/tensorflow,theflofly/tensorflow,jhseu/tensorflow,jart/tensorflow,aam-at/tensorflow,freedomtan/tensorflow,ppwwyyxx/tensorflow,gunan/tensorflow,freedomtan/tensorflow,seanli9jan/tensorflow,jhseu/tensorflow,AnishShah/tensorflow,jalexvig/tensorflow,yongtang/tensorflow,chemelnucfin/tensorflow,sarvex/tensorflow,brchiu/tensorflow,freedomtan/tensorflow,Bismarrck/tensorflow,xodus7/tensorflow,arborh/tensorflow,apark263/tensorflow,aselle/tensorflow,apark263/tensorflow,annarev/tensorflow,renyi533/tensorflow,tensorflow/tensorflow-pywrap_saved_model,drpngx/tensorflow,meteorcloudy/tensorflow,ppwwyyxx/tensorflow,paolodedios/tensorflow,DavidNorman/tensorflow,ZhangXinNan/tensorflow,chemelnucfin/tensorflow,hfp/tensorflow-xsmm,ghchinoy/tensorflow,frreiss/tensorflow-fred,xodus7/tensorflow,seanli9jan/tensorflow,gunan/tensorflow,jhseu/tensorflow,Intel-tensorflow/tensorflow,meteorcloudy/tensorflow,freedomtan/tensorflow,hfp/tensorflow-xsmm,jbedorf/tensorflow,Bismarrck/tensorflow,ageron/tensorflow,gunan/tensorflow,dancingdan/tensorflow,jhseu/tensorflow,AnishShah/tensorflow,ZhangXinNan/tensorflow,drpngx/tensorflow,annarev/tensorflow,aldian/tensorflow,brchiu/tensorflow,apark263/tensorflow,tensorflow/tensorflow,arborh/tensorflow,manipopopo/tensorflow,aselle/tensorflow,hfp/tensorflow-xsmm,jendap/tensorflow,xzturn/tensorflow,karllessard/tensorflow,karllessard/tensorflow,tensorflow/tensorflow,petewarden/tensorflow,sarvex/tensorflow,jbedorf/tensorflow,gautam1858/tensorflow,annarev/tensorflow,frreiss/tensorflow-fred,aselle/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,annarev/tensorflow,meteorcloudy/tensorflow,adit-chandra/tensorflow,kevin-coder/tensorflow-fork,karllessard/tensorflow,caisq/tensorflow,ZhangXinNan/tensorflow,manipopopo/tensorflow,apark263/tensorflow,jhseu/tensorflow,AnishShah/tensorflow,freedomtan/tensorflow,frreiss/tensorflow-fred,AnishShah/tensorflow,Bismarrck/tensorflow,cxxgtxy/tensorflow,yongtang/tensorflow,cxxgtxy/tensorflow,Intel-tensorflow/tensorflow,drpngx/tensorflow,alshedivat/tensorflow,xzturn/tensorflow,jendap/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,theflofly/tensorflow,Intel-Corporation/tensorflow,chemelnucfin/tensorflow,apark263/tensorflow,cxxgtxy/tensorflow,arborh/tensorflow,petewarden/tensorflow,hehongliang/tensorflow,tensorflow/tensorflow-pywrap_saved_model,ageron/tensorflow,freedomtan/tensorflow,frreiss/tensorflow-fred,tensorflow/tensorflow-experimental_link_static_libraries_once,meteorcloudy/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,gunan/tensorflow,asimshankar/tensorflow,Intel-Corporation/tensorflow,frreiss/tensorflow-fred,theflofly/tensorflow,gunan/tensorflow,jbedorf/tensorflow,Intel-tensorflow/tensorflow,asimshankar/tensorflow,girving/tensorflow,Bismarrck/tensorflow,caisq/tensorflow,ghchinoy/tensorflow,seanli9jan/tensorflow,dancingdan/tensorflow,hehongliang/tensorflow,DavidNorman/tensorflow,arborh/tensorflow,tensorflow/tensorflow-pywrap_saved_model,jalexvig/tensorflow,renyi533/tensorflow,brchiu/tensorflow,meteorcloudy/tensorflow,gunan/tensorflow,manipopopo/tensorflow,drpngx/tensorflow,tensorflow/tensorflow,tensorflow/tensorflow,ZhangXinNan/tensorflow,adit-chandra/tensorflow,xodus7/tensorflow,dancingdan/tensorflow,yongtang/tensorflow,adit-chandra/tensorflow,manipopopo/tensorflow,hfp/tensorflow-xsmm,snnn/tensorflow,adit-chandra/tensorflow,adit-chandra/tensorflow,xzturn/tensorflow,dongjoon-hyun/tensorflow,ppwwyyxx/tensorflow,xodus7/tensorflow,girving/tensorflow,dongjoon-hyun/tensorflow,aselle/tensorflow,ageron/tensorflow,brchiu/tensorflow,alshedivat/tensorflow,xzturn/tensorflow,alsrgv/tensorflow,Bismarrck/tensorflow,alshedivat/tensorflow,petewarden/tensorflow,dancingdan/tensorflow,arborh/tensorflow,aam-at/tensorflow,ghchinoy/tensorflow,alsrgv/tensorflow,arborh/tensorflow,alshedivat/tensorflow,dongjoon-hyun/tensorflow,girving/tensorflow,annarev/tensorflow,adit-chandra/tensorflow,jbedorf/tensorflow,gunan/tensorflow,yongtang/tensorflow,jbedorf/tensorflow,jbedorf/tensorflow,karllessard/tensorflow,xodus7/tensorflow,seanli9jan/tensorflow,renyi533/tensorflow,frreiss/tensorflow-fred,jbedorf/tensorflow,chemelnucfin/tensorflow,asimshankar/tensorflow,kevin-coder/tensorflow-fork,renyi533/tensorflow,gautam1858/tensorflow,annarev/tensorflow,asimshankar/tensorflow,brchiu/tensorflow,caisq/tensorflow,cxxgtxy/tensorflow,chemelnucfin/tensorflow,kobejean/tensorflow,jendap/tensorflow,jart/tensorflow,jalexvig/tensorflow,cxxgtxy/tensorflow,sarvex/tensorflow,AnishShah/tensorflow,davidzchen/tensorflow,jhseu/tensorflow,theflofly/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,arborh/tensorflow,tensorflow/tensorflow,tensorflow/tensorflow-pywrap_saved_model,petewarden/tensorflow,jendap/tensorflow,paolodedios/tensorflow,ZhangXinNan/tensorflow,tensorflow/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,Intel-Corporation/tensorflow,xzturn/tensorflow,girving/tensorflow,petewarden/tensorflow,yongtang/tensorflow,jart/tensorflow,Bismarrck/tensorflow,hfp/tensorflow-xsmm,drpngx/tensorflow,jendap/tensorflow,kevin-coder/tensorflow-fork,drpngx/tensorflow,DavidNorman/tensorflow,alshedivat/tensorflow,hfp/tensorflow-xsmm,davidzchen/tensorflow,xzturn/tensorflow,dancingdan/tensorflow,dongjoon-hyun/tensorflow,tensorflow/tensorflow,arborh/tensorflow,jalexvig/tensorflow,ghchinoy/tensorflow,aldian/tensorflow,dongjoon-hyun/tensorflow,dancingdan/tensorflow,AnishShah/tensorflow,aldian/tensorflow,dongjoon-hyun/tensorflow,annarev/tensorflow,xodus7/tensorflow,jhseu/tensorflow,dancingdan/tensorflow,snnn/tensorflow,brchiu/tensorflow,jbedorf/tensorflow,seanli9jan/tensorflow,yongtang/tensorflow,ppwwyyxx/tensorflow,ppwwyyxx/tensorflow,drpngx/tensorflow,xzturn/tensorflow,jalexvig/tensorflow,aselle/tensorflow,gunan/tensorflow,alshedivat/tensorflow,theflofly/tensorflow,Intel-Corporation/tensorflow,hehongliang/tensorflow,ageron/tensorflow,kobejean/tensorflow,ppwwyyxx/tensorflow,davidzchen/tensorflow,Intel-tensorflow/tensorflow,xzturn/tensorflow,gautam1858/tensorflow,drpngx/tensorflow,dancingdan/tensorflow,hehongliang/tensorflow,chemelnucfin/tensorflow,aam-at/tensorflow,brchiu/tensorflow,adit-chandra/tensorflow,DavidNorman/tensorflow,aam-at/tensorflow,jhseu/tensorflow,dancingdan/tensorflow,Bismarrck/tensorflow,renyi533/tensorflow,ageron/tensorflow,ppwwyyxx/tensorflow,aldian/tensorflow,DavidNorman/tensorflow,kevin-coder/tensorflow-fork,ppwwyyxx/tensorflow,xodus7/tensorflow,apark263/tensorflow,adit-chandra/tensorflow,alsrgv/tensorflow,paolodedios/tensorflow,jendap/tensorflow,kevin-coder/tensorflow-fork,ghchinoy/tensorflow,hfp/tensorflow-xsmm,Bismarrck/tensorflow,petewarden/tensorflow,seanli9jan/tensorflow,freedomtan/tensorflow,snnn/tensorflow,annarev/tensorflow,theflofly/tensorflow,snnn/tensorflow,jendap/tensorflow,jart/tensorflow,theflofly/tensorflow,apark263/tensorflow,DavidNorman/tensorflow,xodus7/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,gunan/tensorflow,AnishShah/tensorflow,paolodedios/tensorflow,dongjoon-hyun/tensorflow,renyi533/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,aselle/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,meteorcloudy/tensorflow,aselle/tensorflow,AnishShah/tensorflow,ZhangXinNan/tensorflow,aam-at/tensorflow,girving/tensorflow,caisq/tensorflow,renyi533/tensorflow,girving/tensorflow,DavidNorman/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,paolodedios/tensorflow,jhseu/tensorflow,xzturn/tensorflow,ZhangXinNan/tensorflow,Intel-tensorflow/tensorflow,cxxgtxy/tensorflow,gautam1858/tensorflow,jhseu/tensorflow,yongtang/tensorflow,karllessard/tensorflow,kobejean/tensorflow,hfp/tensorflow-xsmm,annarev/tensorflow,kobejean/tensorflow,meteorcloudy/tensorflow,freedomtan/tensorflow,kobejean/tensorflow,girving/tensorflow,paolodedios/tensorflow,ghchinoy/tensorflow,xodus7/tensorflow,ZhangXinNan/tensorflow,jalexvig/tensorflow,davidzchen/tensorflow,ppwwyyxx/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,alsrgv/tensorflow,theflofly/tensorflow,karllessard/tensorflow,ageron/tensorflow,ageron/tensorflow,snnn/tensorflow,alsrgv/tensorflow,renyi533/tensorflow,davidzchen/tensorflow,gautam1858/tensorflow,ageron/tensorflow,jendap/tensorflow,dongjoon-hyun/tensorflow,kobejean/tensorflow,Intel-Corporation/tensorflow,alshedivat/tensorflow,caisq/tensorflow,davidzchen/tensorflow,renyi533/tensorflow,jhseu/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,chemelnucfin/tensorflow,asimshankar/tensorflow,manipopopo/tensorflow,ageron/tensorflow,asimshankar/tensorflow,tensorflow/tensorflow-pywrap_saved_model,kobejean/tensorflow,alsrgv/tensorflow,aldian/tensorflow,petewarden/tensorflow,paolodedios/tensorflow,apark263/tensorflow,Intel-Corporation/tensorflow,jart/tensorflow,karllessard/tensorflow,asimshankar/tensorflow,Bismarrck/tensorflow,davidzchen/tensorflow,asimshankar/tensorflow,tensorflow/tensorflow-pywrap_saved_model,snnn/tensorflow,aam-at/tensorflow,xzturn/tensorflow,seanli9jan/tensorflow,renyi533/tensorflow,sarvex/tensorflow,dancingdan/tensorflow,DavidNorman/tensorflow,arborh/tensorflow,jendap/tensorflow,tensorflow/tensorflow-pywrap_saved_model,arborh/tensorflow,drpngx/tensorflow,freedomtan/tensorflow,hehongliang/tensorflow,alshedivat/tensorflow,kevin-coder/tensorflow-fork,jalexvig/tensorflow,DavidNorman/tensorflow,adit-chandra/tensorflow,sarvex/tensorflow,tensorflow/tensorflow,tensorflow/tensorflow,alshedivat/tensorflow,caisq/tensorflow,freedomtan/tensorflow,frreiss/tensorflow-fred,gautam1858/tensorflow,apark263/tensorflow,aldian/tensorflow,Intel-tensorflow/tensorflow,jalexvig/tensorflow,theflofly/tensorflow,yongtang/tensorflow,aam-at/tensorflow,dongjoon-hyun/tensorflow,gunan/tensorflow,paolodedios/tensorflow,xodus7/tensorflow,davidzchen/tensorflow,tensorflow/tensorflow,aldian/tensorflow,girving/tensorflow,jendap/tensorflow,alsrgv/tensorflow,aam-at/tensorflow,karllessard/tensorflow,gautam1858/tensorflow,seanli9jan/tensorflow,davidzchen/tensorflow,paolodedios/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,girving/tensorflow,seanli9jan/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,manipopopo/tensorflow,aldian/tensorflow,dongjoon-hyun/tensorflow,snnn/tensorflow,ppwwyyxx/tensorflow,gautam1858/tensorflow,snnn/tensorflow,annarev/tensorflow,ppwwyyxx/tensorflow,Bismarrck/tensorflow,Intel-tensorflow/tensorflow,jbedorf/tensorflow,tensorflow/tensorflow-pywrap_saved_model,yongtang/tensorflow,DavidNorman/tensorflow,manipopopo/tensorflow,renyi533/tensorflow,snnn/tensorflow