This is an archive of the discontinued LLVM Phabricator instance.

[PatternMatch] define m_Not using m_Xor and cst_pred_ty
ClosedPublic

Authored by spatel on Mar 4 2018, 7:00 AM.

Details

Summary

As the tests show, using cst_pred_ty in the definition allows us to match vectors with undef elements.

This appears to do what I was hoping for with maximal reuse of the existing code, but my grasp of C++ templates is too weak to know if I've broken any laws here.

My initial patch just replaced the lines in the existing not_match struct like this:

-- if (isAllOnes(O->getOperand(1)) 
++ if (m_AllOnes().match(O->getOperand(1)))

...and that seems to work too, but this way removes more code (assuming it's ok).

This is a continuation to make all pattern matchers allow undef elements in vectors:
https://reviews.llvm.org/rL325437
https://reviews.llvm.org/rL325466
D43792

Diff Detail

Repository
rL LLVM

Event Timeline

spatel created this revision.Mar 4 2018, 7:00 AM
spatel edited the summary of this revision. (Show Details)Mar 4 2018, 7:02 AM
spatel edited the summary of this revision. (Show Details)
arsenm accepted this revision.Mar 6 2018, 8:06 AM

LGTM

This revision is now accepted and ready to land.Mar 6 2018, 8:06 AM
This revision was automatically updated to reflect the committed changes.