Page MenuHomePhabricator

[APInt} Add saturating left-shift ops
ClosedPublic

Authored by lebedev.ri on Thu, Oct 24, 10:47 AM.

Details

Summary

There are *_ov() functions already, so at least for consistency it may be good to also have saturating variants.
These may or may not be needed for ConstantRange's shlWithNoWrap()

Diff Detail

Event Timeline

lebedev.ri created this revision.Thu, Oct 24, 10:47 AM
nikic accepted this revision.Thu, Oct 24, 11:49 AM

LGTM

llvm/unittests/ADT/APIntTest.cpp
1225

It's a bit weird that out-of-bounds shift amounts have well-defined behavior here, but as this is an existing behavior of shl_ov, I guess it makes sense.

This revision is now accepted and ready to land.Thu, Oct 24, 11:49 AM
This revision was automatically updated to reflect the committed changes.