[PATCH] D141994: [IndVars] Expand icmp in preheader rather than in loop

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 18 03:22:09 PST 2023


mkazantsev added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/IndVarSimplify.cpp:1363
   BranchInst *BI = cast<BranchInst>(ExitingBB->getTerminator());
   Rewriter.setInsertPoint(BI);
   auto *LHSV = Rewriter.expandCodeFor(LIP.LHS);
----------------
nikic wrote:
> Shouldn't the Rewriter expand in the preheader as well? Can LHSV/RHSV ever *not* be loop invariant in this function?
They should always be invariant. I also think that expander's insertion point can be in preheader.


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

https://reviews.llvm.org/D141994



More information about the llvm-commits mailing list