[PATCH] D44076: [PatternMatch] define m_Not using m_Xor and cst_pred_ty

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Mar 4 07:01:46 PST 2018


spatel created this revision.
spatel added reviewers: craig.topper, RKSimon, arsenm.
Herald added subscribers: wdng, mcrosier.

As the tests show, using cst_pred_ty in the definition allows us to match vectors with undef elements.

This appears to do what I was hoping for with maximal reuse of the existing code, but my grasp of C++ templates is too weak to know if I've broken any laws here.

My initial patch just replaced the lines in the existing not_match struct like this:

- if (isAllOnes(O->getOperand(1))

++ if (m_AllOnes().match(O->getOperand(1)))

This is a continuation of  to make pattern matchers allow 
...and that seems to work too, but this way removes more code (assuming it's ok).


https://reviews.llvm.org/D44076

Files:
  include/llvm/IR/PatternMatch.h
  test/Transforms/InstCombine/sub.ll
  test/Transforms/InstCombine/vector-xor.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D44076.136938.patch
Type: text/x-patch
Size: 4521 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180304/0cba6207/attachment.bin>


More information about the llvm-commits mailing list