This is an archive of the discontinued LLVM Phabricator instance.

[X86] CombineBT - more aggressively determine demanded bits
ClosedPublic

Authored by RKSimon on Jul 26 2017, 9:07 AM.

Details

Summary

This patch is in 2 parts that can be committed separately if desired:

1 - replace combineBT's use of SimplifyDemandedBits (hasOneUse only) with SelectionDAG::GetDemandedBits to more aggressively determine the lower bits used by BT.

2 - update SelectionDAG::GetDemandedBits to support ANY_EXTEND - if the demanded bits are only in the non-extended portion, then peek through and demand from the source value and then ANY_EXTEND that if we found a match.

Diff Detail

Repository
rL LLVM

Event Timeline

RKSimon created this revision.Jul 26 2017, 9:07 AM
craig.topper added inline comments.Jul 26 2017, 6:04 PM
lib/CodeGen/SelectionDAG/SelectionDAG.cpp
2007 ↗(On Diff #108296)

This doesn't seem right to me. Doesn't that get the upper SrcBitWidth bits of Mask? But the extended bits should be (BitWidth - SrcBitWidth) right?

But in any case can't this be 'if (Mask.getActiveBits() > SrcBitWidth)' which would avoid a temporary APInt.

RKSimon updated this revision to Diff 108618.Jul 28 2017, 3:32 AM

Use APInt::getActiveBits to avoid temp APInt creation

This revision is now accepted and ready to land.Jul 28 2017, 9:15 AM
This revision was automatically updated to reflect the committed changes.