[PATCH] D45617: [IRCE] Only check for NSW on equality predicates

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 16 02:05:41 PDT 2018


mkazantsev added inline comments.


================
Comment at: lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp:923
   const SCEVAddRecExpr *IndVarBase = cast<SCEVAddRecExpr>(LeftSCEV);
-  bool IsIncreasing = false;
-  bool IsSignedPredicate = true;
-  ConstantInt *StepCI;
-  if (!IsInductionVar(IndVarBase, IsIncreasing, StepCI)) {
+  const SCEV* StepRec = IndVarBase->getStepRecurrence(SE);
+  if (!isa<SCEVConstant>(StepRec) || !IndVarBase->isAffine()) {
----------------
Please do affinity check first and take StepRecurrence only if it passes, it will save you some compile time on non-affine phis. Also can be dyn_cast.


https://reviews.llvm.org/D45617





More information about the llvm-commits mailing list