This is an archive of the discontinued LLVM Phabricator instance.

[SelectionDAG] Optional handling of UNDEF elements in matchBinaryPredicate
ClosedPublic

Authored by RKSimon on Dec 18 2018, 6:33 AM.

Details

Summary

Now that SimplifyDemandedBits/SimplifyDemandedVectorElts is simplifying vector elements, we're seeing more constant BUILD_VECTOR containing undefs.

This patch provides opt-in support for UNDEF elements in matchBinaryPredicate, passing NULL instead of the result ConstantSDNode* argument.

I've updated the (or (and X, c1), c2) -> (and (or X, c2), c1|c2) fold to demonstrate its use, which I believe is safe for undef cases.

Diff Detail

Repository
rL LLVM

Event Timeline

RKSimon created this revision.Dec 18 2018, 6:33 AM

As I wrote to D55819, I think this is a nice improvement and makes the matching logic resilient to the presence of undefs in the input vectors. It also fixes the regression introduced by D55600 in @knownbits_mask_or_shuffle_uitofp. So, overall, I think this is a nice improvement.

This revision is now accepted and ready to land.Dec 18 2018, 5:49 PM
This revision was automatically updated to reflect the committed changes.