[PATCH] D48305: [IR] Introduce helpers to skip meta-instructions

Vedant Kumar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 18 16:57:38 PDT 2018


vsk created this revision.
vsk added reviewers: fhahn, davide, dblaikie, aprantl, efriedma.

This patch introduces a few APIs to make it easier to ignore debug
intrinsics and other meta-instructions.

- Instruction::isMeta()

  This identifies instructions which describe a program and otherwise have no effect.
- Instruction::getNextNonMetaInstruction()

  This is just like Instruction::getNextNode(), except that it skips meta-instructions. It finds the first non-meta instruction after 'this', or nullptr if no such instruction exists.
- skipMetaInstructions(BasicBlock::iterator)

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

This is a mostly-NFC patch. Apart from introducing some APIs, it just
updates a few places in LLVM which skipped debug instructions to skip
other meta-instructions as well.

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


https://reviews.llvm.org/D48305

Files:
  include/llvm/IR/BasicBlock.h
  include/llvm/IR/Instruction.h
  lib/IR/BasicBlock.cpp
  lib/IR/Instruction.cpp
  lib/Transforms/InstCombine/InstCombineCalls.cpp
  lib/Transforms/Scalar/LoopRerollPass.cpp
  unittests/IR/InstructionsTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D48305.151822.patch
Type: text/x-patch
Size: 8921 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180618/dea05d41/attachment.bin>


More information about the llvm-commits mailing list