Issue 208401
Summary [PatternMatch] Add m_SpecificType(Type*) matcher
Labels good first issue, llvm:core, llvm:instcombine
Assignees
Reporter RKSimon
    Noticed in #207564 - where we end up matching like:
```cpp
  // zext(sub(0, trunc(X))) -> and(sub(0, X), mask)
  if (match(Src, m_Sub(m_Zero(), m_Trunc(m_Value(X)))) &&
      X->getType() == DestTy) {
```
which could be handled as:
```cpp
  // zext(sub(0, trunc(X))) -> and(sub(0, X), mask)
 if (match(Src, m_Sub(m_Zero(), m_Trunc(m_Value(X, m_SpecificType(DestTy)))))) {
```
there seems to be quite a few similar cases in InstCombineCasts.cpp for instance

Similar to SDPatternMatch::m_SpecificVT - might be worth including a m_SpecificType(Type*, Pattern &P) variant?
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to