LoopPass: Simplify the API for adding a new loop. NFC
[oota-llvm.git] / lib / Transforms / Utils / SimplifyIndVar.cpp
index c7ec1bc263d3214a8bba457fcc381db37673a7a2..58715fa4bef1aafb4abdaafec8787b0e9be235a0 100644 (file)
@@ -333,6 +333,9 @@ bool SimplifyIndvar::eliminateIdentitySCEV(Instruction *UseInst,
     if (!DT || !DT->dominates(IVOperand, UseInst))
       return false;
 
+  if (!LI->replacementPreservesLCSSAForm(UseInst, IVOperand))
+    return false;
+
   DEBUG(dbgs() << "INDVARS: Eliminated identity: " << *UseInst << '\n');
 
   UseInst->replaceAllUsesWith(IVOperand);