[llvm] [PatternMatch] Add a matching helper `m_ElementWiseBitCast`. NFC. (PR #80764)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 6 21:03:41 PST 2024


================
@@ -1711,6 +1711,34 @@ m_BitCast(const OpTy &Op) {
   return CastOperator_match<OpTy, Instruction::BitCast>(Op);
 }
 
+template <typename Op_t> struct ElementWiseBitCast_match {
+  Op_t Op;
+
+  ElementWiseBitCast_match(const Op_t &OpMatch) : Op(OpMatch) {}
+
+  template <typename OpTy> bool match(OpTy *V) {
+    if (auto *I = dyn_cast<BitCastInst>(V)) {
----------------
arsenm wrote:

Can early return and reduce indent

https://github.com/llvm/llvm-project/pull/80764


More information about the llvm-commits mailing list