Deprecating APInt::truncOrSelf, zextOrSelf and sextOrSelf

I have just committed ⚙ D125558 [APInt] Deprecate truncOrSelf, zextOrSelf and sextOrSelf to deprecate these functions.

I plan to remove them in a week or two: ⚙ D125559 [APInt] Remove truncOrSelf, zextOrSelf and sextOrSelf

Anyone using these functions should switch to using the standard trunc, zext and sext methods. In most cases this is a drop-in replacement, since these functions now support the no-op case of truncating/extending to the same bit width (⚙ D125556 [APInt] Allow extending and truncating to the same width).

The truncOrSelf, zextOrSelf and sextOrSelf also had an odd, undocumented and likely unintentional behaviour where they would let you try to truncate to a larger bit width (or extend to a smaller bit width) which was also treated as a no-op. If you were relying on that behaviour then you will need to rewrite it some other way. There are a couple of examples of this in ⚙ D125558 [APInt] Deprecate truncOrSelf, zextOrSelf and sextOrSelf.

Jay.

1 Like

I have now pushed D125559 to remove these functions.

Jay.