This is an archive of the discontinued LLVM Phabricator instance.

[X86] Add INSERT_SUBVECTOR to ComputeNumSignBits
ClosedPublic

Authored by craig.topper on Jan 3 2019, 11:27 AM.

Details

Summary

This adds support for calculating sign bits of insert_subvector. I based it on the computeKnownBits.

My motivating case is propagating sign bits information across basic blocks on AVX targets. Working on reduced test case.

Diff Detail

Event Timeline

craig.topper created this revision.Jan 3 2019, 11:27 AM
RKSimon added inline comments.Jan 3 2019, 1:36 PM
lib/CodeGen/SelectionDAG/SelectionDAG.cpp
3719

auto *SubIdx

3722

Use same approach as CONCAT_VECTORS above:

Tmp = std::numeric_limits<unsigned>::max();
...
assert(Tmp <= VTBits && "Failed to determine minimum sign bits");
3739

Is it safe to use DemandedElts at least on Src?

3743

Add a break - even though its the last case in the switch

craig.topper marked 2 inline comments as done.Jan 3 2019, 2:44 PM
craig.topper added inline comments.
lib/CodeGen/SelectionDAG/SelectionDAG.cpp
3739

Maybe, but in practice we probably don't have insert_subvector with non-constant or out of bounds elements so its not going to get used much. We don't pass the demanded mask on the equivalent path in computeKnownBits either.

3743

I'm going to drop the else around this since we returned in the earlier block.

Address review comments. Add test case.

RKSimon accepted this revision.Jan 4 2019, 3:41 AM

LGTM - cheers

This revision is now accepted and ready to land.Jan 4 2019, 3:41 AM
This revision was automatically updated to reflect the committed changes.