[PATCH] D69245: [InstCombine] Canonicalize uadd.with.overflow to uadd.sat

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 28 01:10:45 PDT 2019


nikic added inline comments.


================
Comment at: llvm/include/llvm/IR/PatternMatch.h:561-563
+/// Match an instruction of type T, capturing it if we match.
+/// For example m_isa<WithOverflowInst>(Y)
+template <typename T> inline bind_ty<T> m_isa(T *&I) { return I; }
----------------
lebedev.ri wrote:
> I don't like this one.
> Can we change it to be a two-step process - just make `m_isa<>()` a predicate,
> if `isa<>()` matches, then it should apply inner matcher, if any.
> And said inner matcher can be `m_Value()`.
I'm not sure I understand how that would be used. If you use something like `m_isa<WithOverflowInst>(m_Value(V))`, wouldn't `V` have to be `Value *` rather than `WithOverflowInst *`? That seems less useful to me. It's also not clear what things apart from `m_Value()` you would use as the inner matcher.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69245/new/

https://reviews.llvm.org/D69245





More information about the llvm-commits mailing list