[PATCH] D45657: [Instruction, BasicBlock] Add is_none_of and skipInsts helper functions.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 14 14:14:57 PDT 2018


fhahn created this revision.
fhahn added reviewers: aprantl, vsk, mattd, chandlerc.
Herald added a subscriber: zzheng.

As discussed in https://reviews.llvm.org/D45379, I have prototyped a simple way to skip certain
instructions using filter_range. It consists of `is_any_of` and
`is_none_of` variadic templates, that take an instruction and return
true if it is an instance of any of the template arguments or if it is
not, respectively.

It also adds a `skipInsts` variadic template to BasicBlock, that returns
an iterator skipping over instances of any of the variadic template
arguments.

Finally, I have updated a few places to use skipInsts, to give an idea
of how it can be used.

I am not sure who exactly should be the reviewers for such a change.
Please let me know what you think and who else should be added to
the review.

Thanks to George Steed for helping me out with a template issue.


https://reviews.llvm.org/D45657

Files:
  include/llvm/IR/BasicBlock.h
  include/llvm/IR/Instruction.h
  lib/Transforms/IPO/GlobalOpt.cpp
  lib/Transforms/IPO/PartialInlining.cpp
  lib/Transforms/Scalar/GVN.cpp
  lib/Transforms/Utils/LoopSimplify.cpp
  lib/Transforms/Utils/LoopUnroll.cpp
  unittests/IR/BasicBlockTest.cpp
  unittests/IR/InstructionsTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45657.142527.patch
Type: text/x-patch
Size: 11932 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180414/702d591d/attachment.bin>


More information about the llvm-commits mailing list