[PATCH] D38494: [ScalarEvolution] Handling for ICmp occuring in the evolution chain.

Sanjoy Das via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 20 10:34:54 PDT 2017


sanjoy requested changes to this revision.
sanjoy added inline comments.
This revision now requires changes to proceed.


================
Comment at: llvm/trunk/lib/Analysis/ScalarEvolution.cpp:4762
+      if (!InvariantF && Accum->getSCEVType() == scZeroExtend) {
+        const SCEV *Op = dyn_cast<SCEVZeroExtendExpr>(Accum)->getOperand();
+        const SCEVUnknown *Un = dyn_cast<SCEVUnknown>(Op);
----------------
This is in the right direction, but I would do it a bit more generally.  I'd use `SCEVRewriteVisitor` to rewrite any `SCEVUnknown` in `Accum` with the backedge taken condition as `0` or `1` (depending on the direction of the latch).  That should handle not just `zext` but any general function of the latch condition.


Repository:
  rL LLVM

https://reviews.llvm.org/D38494





More information about the llvm-commits mailing list