[PATCH] D49151: [SimplifyIndVar] Avoid generating truncate instructions with non-hoisted Load operand.

Sebastian Pop via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 6 16:18:17 PDT 2018


sebpop accepted this revision.
sebpop added a comment.
This revision is now accepted and ready to land.

The patch looks good to me.
Please address the last two comments and then apply.



================
Comment at: llvm/lib/Transforms/Scalar/IndVarSimplify.cpp:1440
+      auto *User = cast<Instruction>(U.getUser());
+      if (isa<ZExtInst>(User) && User->getType() == WideType)
+        continue;
----------------
Let's simplify the loop like so:

  for () {
    ZExtInst *User = dyn_cast<ZExtInst>(U.getUser());
    if (!User || User->getType() != WideType)
      return false;
  }

and the same for the signExtend loop.


================
Comment at: llvm/lib/Transforms/Scalar/IndVarSimplify.cpp:1507
+
+  return;
+}
----------------
please remove return stmt.


https://reviews.llvm.org/D49151





More information about the llvm-commits mailing list