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

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 10 05:08:09 PST 2023


mkazantsev added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/IndVarSimplify.cpp:1480
+        NCI->setName(OldCond->getName() + ".first_iter");
+        NCI->moveBefore(cast<Instruction>(OldCond));
+      }
----------------
mkazantsev wrote:
> mkazantsev wrote:
> > nikic wrote:
> > > Should we be setting the insert point on Rewriter instead? Mainly wondering if we might generate multiple insts and this then only moves one of them.
> > Interesting point, will check.
> in short: `createInvariantCond` uses BI as expansion point for icmp and not rewriter's insertion point. I think this can be changed, but takes more than flick of fingers. Now much are you concerned? Can it go as follow-up?
> 
> We never generate more than 1 non-invariant instruction here as far as I can tell.
i.e. in fact it's also invariant, just placed in the loop. I guess we could instead use rewriter's insertion point and even inject it in preheader.


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

https://reviews.llvm.org/D139832



More information about the llvm-commits mailing list