This is an archive of the discontinued LLVM Phabricator instance.

[APInt] Add APIntOps::ScaleBitMask helper
ClosedPublic

Authored by RKSimon on Sep 13 2021, 4:48 AM.

Details

Summary

APInt is used to describe a bit mask in a variety of value tracking and demanded bits/elts functions.

When traversing through dst/src operands, we have a number of places where these masks need to widened/narrowed to translate through bitcasts, reductions etc. to a different type.

This patch add a APIntOps::ScaleBitMask common helper, adds unit test coverage, and updates a number of cases to use the the helper instead of their own implementation.

This came up on D109065 where we currently have to add yet another implementation of the same code.

Diff Detail

Event Timeline

RKSimon created this revision.Sep 13 2021, 4:48 AM
RKSimon requested review of this revision.Sep 13 2021, 4:48 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 13 2021, 4:48 AM
lebedev.ri accepted this revision.Sep 13 2021, 5:02 AM

LG, thanks.

This revision is now accepted and ready to land.Sep 13 2021, 5:02 AM
This revision was landed with ongoing or failed builds.Sep 13 2021, 8:28 AM
This revision was automatically updated to reflect the committed changes.