[PATCH] D47928: [SimplifyIndVars] Eliminate redundant truncs

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 12 18:46:17 PDT 2018


mkazantsev added inline comments.


================
Comment at: lib/Transforms/Utils/SimplifyIndVar.cpp:580
 
+  if (auto *TI = dyn_cast<TruncInst>(UseInst))
+    if (eliminateTrunc(TI))
----------------
mkazantsev wrote:
> reames wrote:
> > I'm missing something.  Why do this via a new Trunc specific routine that has to look at users instead of just looking at the icmp directly?  We do end up processing it don't we?
> No, we never process this `icmp(trunc(iv), constant)`.
Clarification: the analysis stops at this point.

    CastInst *Cast = dyn_cast<CastInst>(UseInst);
    if (V && Cast) {
      V->visitCast(Cast);
      continue;
    }

We don't push its users here. Not sure if we should.


https://reviews.llvm.org/D47928





More information about the llvm-commits mailing list