This is an archive of the discontinued LLVM Phabricator instance.

[ValueTracking] improve ComputeNumSignBits for vectors
ClosedPublic

Authored by spatel on Jun 22 2016, 8:09 AM.

Details

Summary

This is similar to the computeKnownBits improvement in rL268479. There's probably more to do for vector logic instructions, but this should let us see non-splat constant masking ops that can become vector selects instead of and/andn/or sequences.

Side note - I don't know how this line under the computeKnownBits() call in this patch could ever shift by any amount other than zero:

Mask <<= Mask.getBitWidth()-TyBits;

We can delete that unless I'm misunderstanding.

Diff Detail

Repository
rL LLVM

Event Timeline

spatel updated this revision to Diff 61552.Jun 22 2016, 8:09 AM
spatel retitled this revision from to [ValueTracking] improve ComputeNumSignBits for vectors.
spatel updated this object.
spatel added reviewers: majnemer, eli.friedman, sanjoy.
spatel added a subscriber: llvm-commits.
eli.friedman accepted this revision.Jun 22 2016, 10:35 AM
eli.friedman edited edge metadata.

LGTM.

I did a bit of digging about the "Mask <<= Mask.getBitWidth()-TyBits;" thing; it looks like r47654 is at fault. (The original version of the code used uint64_t instead of APInt.)

This revision is now accepted and ready to land.Jun 22 2016, 10:35 AM

LGTM.

I did a bit of digging about the "Mask <<= Mask.getBitWidth()-TyBits;" thing; it looks like r47654 is at fault. (The original version of the code used uint64_t instead of APInt.)

Thanks for finding that. I'll delete that line as a separate commit then.

This revision was automatically updated to reflect the committed changes.