[LoopStrengthReduce] Don't bother fixing up PHIs from EH Pad preds
[oota-llvm.git] / lib / Transforms / Scalar / LoopStrengthReduce.cpp
index 7a7d0359b1785e3f22e1323ea67fd9302ab89c69..9351a284c86a68ba7c0d3d6891454dd9034b1fba 100644 (file)
@@ -3132,6 +3132,9 @@ LSRInstance::CollectLoopInvariantFixupsAndFormulae() {
             PHINode::getIncomingValueNumForOperand(U.getOperandNo()));
         if (!DT.dominates(L->getHeader(), UseBB))
           continue;
+        // Don't bother if the instruction is in a BB which ends in an EHPad.
+        if (UseBB->getTerminator()->isEHPad())
+          continue;
         // Ignore uses which are part of other SCEV expressions, to avoid
         // analyzing them multiple times.
         if (SE.isSCEVable(UserInst->getType())) {