diff options
author | Vedant Kumar <vsk@apple.com> | 2018-06-19 23:42:17 +0000 |
---|---|---|
committer | Vedant Kumar <vsk@apple.com> | 2018-06-19 23:42:17 +0000 |
commit | f01827f2d1bdaff14cf1cf176e8a69e308d5371e (patch) | |
tree | defc86236f3ff9e5193b677abc6606f4cc4deba9 /llvm/lib/IR/BasicBlock.cpp | |
parent | 3d7f00d25bb56b13e4c39f4406e2efa8d9e7a886 (diff) | |
download | llvm-f01827f2d1bdaff14cf1cf176e8a69e308d5371e.zip llvm-f01827f2d1bdaff14cf1cf176e8a69e308d5371e.tar.gz llvm-f01827f2d1bdaff14cf1cf176e8a69e308d5371e.tar.bz2 |
[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
llvm-svn: 335083
Diffstat (limited to 'llvm/lib/IR/BasicBlock.cpp')
-rw-r--r-- | llvm/lib/IR/BasicBlock.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/IR/BasicBlock.cpp b/llvm/lib/IR/BasicBlock.cpp index c103de4..005a772 100644 --- a/llvm/lib/IR/BasicBlock.cpp +++ b/llvm/lib/IR/BasicBlock.cpp @@ -479,3 +479,9 @@ Optional<uint64_t> BasicBlock::getIrrLoopHeaderWeight() const { } return Optional<uint64_t>(); } + +BasicBlock::iterator llvm::skipDebugInfo(BasicBlock::iterator It) { + while (isa<DbgInfoIntrinsic>(It)) + ++It; + return It; +} |