[all-commits] [llvm/llvm-project] ed80c8: [PatternMatch] Add m_APInt/m_APFloat matchers acce...

Nikita Popov via All-commits all-commits at lists.llvm.org
Wed Jan 22 13:49:57 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: ed80c86c8854647ad6246544e3865e416ecfc451
      https://github.com/llvm/llvm-project/commit/ed80c86c8854647ad6246544e3865e416ecfc451
  Author: Nikita Popov <nikita.ppv at gmail.com>
  Date:   2020-01-22 (Wed, 22 Jan 2020)

  Changed paths:
    M llvm/include/llvm/IR/PatternMatch.h
    M llvm/unittests/IR/PatternMatch.cpp

  Log Message:
  -----------
  [PatternMatch] Add m_APInt/m_APFloat matchers accepting undef

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
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.

Differential Revision: https://reviews.llvm.org/D72975




More information about the All-commits mailing list