[PATCH] D132571: [RLEV] Pick a correct insert point when incoming instruction is itself a phi node

Yevgeny Rouban via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 1 09:02:03 PDT 2022


yrouban added inline comments.


================
Comment at: llvm/lib/Transforms/Utils/LoopUtils.cpp:1398-1400
+        Instruction *InsertPt =
+          (isa<PHINode>(Inst) || isa<LandingPadInst>(Inst)) ?
+          &*Inst->getParent()->getFirstInsertionPt() : Inst;
----------------
reames wrote:
> yrouban wrote:
> > Would it be better to fix //SCEVExpander::expandCodeForImpl(const SCEV *SH, Type *Ty, Instruction *IP, bool Root)// so it fixed IP in the same way? It would fix all its users.
> No.  any routine given an insertion point should use it.  It might make sense to add an *assert* that the insertion point is sane, but mutating the insertion point explicitly would be quite confusing.  
Ok, but in this particular case the insertion point can be adjusted by hoisting in //SCEVExpander::expand()//. In other words the insertion point passed as argument is not final.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D132571



More information about the llvm-commits mailing list