This is an archive of the discontinued LLVM Phabricator instance.

[InstCombine] allow vector types for constant folding / computeKnownBits (PR24942)
ClosedPublic

Authored by spatel on Sep 16 2016, 11:26 AM.

Details

Summary

computeKnownBits() already works for integer vectors, so allow vector types when calling that from InstCombine.

I don't think the change to use m_APInt is strictly necessary in computeKnownBits because we do check for ConstantVector later, but it's more efficient to handle the splat case without needing to loop on vector elements.

This should work with InstSimplify, but doesn't yet, so I made that a FIXME comment on the test for PR24942:
https://llvm.org/bugs/show_bug.cgi?id=24942

Diff Detail

Repository
rL LLVM

Event Timeline

spatel updated this revision to Diff 71678.Sep 16 2016, 11:26 AM
spatel retitled this revision from to [InstCombine] allow vector types for constant folding / computeKnownBits (PR24942).
spatel updated this object.
spatel added reviewers: arsenm, majnemer, efriedma.
spatel added a subscriber: llvm-commits.
majnemer accepted this revision.Sep 16 2016, 11:57 AM
majnemer edited edge metadata.

LGTM

This revision is now accepted and ready to land.Sep 16 2016, 11:57 AM

Thanks, David!

This revision was automatically updated to reflect the committed changes.