Revert "Remove unnecessary null check. NFC."
[oota-llvm.git] / lib / Transforms / Scalar / LoopInterchange.cpp
index 75fe0c77e7b21e3c46bc8bb29ae94c2d1b66a5f2..9d7e57ffebac143a35ed4145450de8e3b2c5fd70 100644 (file)
@@ -817,6 +817,9 @@ bool LoopInterchangeLegality::currentLimitations() {
     InnerIndexVarInc =
         dyn_cast<Instruction>(InnerInductionVar->getIncomingValue(0));
 
+  if (!InnerIndexVarInc)
+    return true;
+
   // Since we split the inner loop latch on this induction variable. Make sure
   // we do not have any instruction between the induction variable and branch
   // instruction.