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

Description

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

This patch introduces two helpers to make it easier to ignore debug
intrinsics:

  • Instruction::getNextNonDebugInstruction()

This is just like Instruction::getNextNode(), except that it skips debug
info.

  • skipDebugInfo(BasicBlock::iterator)

A free function which advances a BasicBlock iterator past any debug
info. This is a no-op when the iterator already points to a non-debug
instruction.

Part of: llvm.org/PR37728
Related to: https://reviews.llvm.org/D47874

Differential Revision: https://reviews.llvm.org/D48305

Details

aprantl added inline comments.
/llvm/trunk/include/llvm/IR/BasicBlock.h
438

Sorry for being late: What do you think about skipDebugInfoIntrinsics? Since every function can have "DebugInfo" in the form of !dbg locations I would find that less misleading.