[PATCH] D72975: [PatternMatch] Add m_APInt/m_APFloat matchers accepting undef

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jan 18 03:30:30 PST 2020


nikic created this revision.
nikic added reviewers: spatel, lebedev.ri.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

The current `m_APInt()` and `m_APFloat()` matchers do not accept splats that include undefs (unlike `m_Zero()` and other matchers for specific values). We can't simply change the default behavior, as there are existing transforms that would not be safe with undefs.

For this reason, I'm introducing new `m_APIntAllowUndef()` and `m_APFloatAllowUndef()` matchers, that allow splats with undefs. Additionally, `m_APIntForbidUndef()` and `m_APFloatForbidUndef()` are added. These have the same behavior as the existing `m_APInt()` and `m_APFloat()`, but serve as an explicit indication that undefs were explicitly considered and found unsound for this transform. This helps distinguish them from existing uses of `m_APInt()` where we do not know whether undefs can or cannot be allowed without additional review.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D72975

Files:
  llvm/include/llvm/IR/PatternMatch.h
  llvm/unittests/IR/PatternMatch.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D72975.238946.patch
Type: text/x-patch
Size: 6738 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200118/08e5cc70/attachment.bin>


More information about the llvm-commits mailing list