[PATCH] D48305: [IR] Introduce helpers to skip debug instructions (NFC)

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 19 13:16:56 PDT 2018


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

LGTM



================
Comment at: lib/IR/Instruction.cpp:602
+      return I;
+  return nullptr;
+}
----------------
vsk wrote:
> efriedma wrote:
> > Maybe this should assert rather than return nullptr?  It's probably a logic error if you're calling getNextNonDebugInstruction() on a terminator.
> Hm, but what about loops which advance an iterator using getNextNode()? Here's one from slp-vectorizer (at least, I think 'ScheduleEnd' can be nullptr here): `for (auto *I = ScheduleStart; I != ScheduleEnd; I = I->getNextNode())`. I'd like getNextNonDebugInst to be a drop-in in these cases.
I don't think ScheduleEnd can actually be null there?

But I guess in general, it could be a useful idiom, sure.


https://reviews.llvm.org/D48305





More information about the llvm-commits mailing list