[PATCH] D70016: [InstCombine] Don't use getFirstNonPHI in FoldIntegerTypedPHI

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 14 12:16:13 PST 2019


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

LGTM



================
Comment at: llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp:183
   unsigned NumPhis = 0;
-  for (auto II = BB->begin(), EI = BasicBlock::iterator(BB->getFirstNonPHI());
-       II != EI; II++, NumPhis++) {
+  for (auto II = BB->begin(); II != BB->end(); II++, NumPhis++) {
     // FIXME: consider handling this in AggressiveInstCombine
----------------
thegameg wrote:
> fhahn wrote:
> > Could you just use the iterator range `BB->phis()`? This should automatically iterate until it hits a non-phi instruction. 
> For some reason using `phis()` gives me similar results as before when using `getFirstNonPHI`. I'll look into it.
Ah right, no worries then!


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

https://reviews.llvm.org/D70016





More information about the llvm-commits mailing list