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

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 28 01:15:56 PDT 2019


lebedev.ri added a reviewer: RKSimon.
lebedev.ri 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; }
----------------
nikic wrote:
> 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.
Good point. I'm mainly unhappy about the name.
`m_isa<>()` really looks similar to normal `isa<>()`, from looking at it i would not
have guessed it takes reference to the pointer of that type and binds to it if matched.


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

https://reviews.llvm.org/D69245





More information about the llvm-commits mailing list