[PATCH] D47983: [IR][PatternMatch] m_APInt(): allow undef elements.

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 18 10:07:12 PDT 2018


spatel accepted this revision.
spatel added a comment.
This revision is now accepted and ready to land.

In https://reviews.llvm.org/D47983#1134797, @lebedev.ri wrote:

> Ping.
>  Or is it intentional for `m_APInt` not to do this?


No, it's not intentional to bail on undef when matching. Until recently, all of the constant matchers failed with undef elements in vectors. I enhanced most of those matchers, but missed this one (and apfloat_match?).

I also made a comment in one of those patches about being careful about changing the binding code, but I was probably confusing api_pred_ty with this. That does need to be careful AFAICT because callers may capture and use a vector with undefs when they didn't mean to.

Sorry for the delay - LGTM.



================
Comment at: include/llvm/IR/PatternMatch.h:170
+          else if (*FirstNonUndefElt != CI->getValue()) // (still non-undef)
+            return false; // Diferent from the first non-undef element.
+        }
----------------
typo - 'Different'


Repository:
  rL LLVM

https://reviews.llvm.org/D47983





More information about the llvm-commits mailing list