[PATCH] D139832: [IndVars] Support AND/OR in optimizeLoopExitWithUnknownExitCount

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 10 03:57:57 PST 2023


nikic added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/IndVarSimplify.cpp:1464
+    // Avoid instruction duplication.
+    if (isa<Instruction>(Curr) && !Curr->hasOneUse())
+      return false;
----------------
mkazantsev wrote:
> mkazantsev wrote:
> > nikic wrote:
> > > I don't think we need to check `isa<Instruction>(Curr) &&` here (I guess you could have a constant expression icmp or something, but the whole transform doesn't make sense for that case).
> > Method parameter with one use?
> i.e. with more than one use.
We're only interested in and/or/icmp here, if one of the operands is a multi-use argument we won't be doing anything with it anyway (that is, it will not get transformed, but it also won't block any transforms on e.g. a different operand).


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D139832/new/

https://reviews.llvm.org/D139832



More information about the llvm-commits mailing list