Page MenuHomePhabricator

[APInt] Add the truncOrSelf resizing operator to APInt
ClosedPublic

Authored by kmclaughlin on Nov 13 2020, 10:41 AM.

Details

Summary

Truncates the APInt if the bit width is greater than the width specified,
otherwise do nothing

Diff Detail

Event Timeline

kmclaughlin created this revision.Nov 13 2020, 10:41 AM
kmclaughlin requested review of this revision.Nov 13 2020, 10:41 AM

Can you perhaps update some code to use this?

RKSimon accepted this revision.Nov 14 2020, 9:06 AM

LGTM with a couple of minors - cheers

llvm/include/llvm/ADT/APInt.h
1398

Maybe move this down to be next to zextOrSelf/sextOrSelf?

llvm/lib/Support/APInt.cpp
952

Maybe move this down to be next to zextOrSelf/sextOrSelf?

This revision is now accepted and ready to land.Nov 14 2020, 9:06 AM
This revision was landed with ongoing or failed builds.Nov 23 2020, 3:40 AM
This revision was automatically updated to reflect the committed changes.
kmclaughlin marked 2 inline comments as done.