[KnownBits] Add a sextOrTrunc method
authorQuentin Colombet <qcolombet@apple.com>
Tue, 6 Oct 2020 23:27:28 +0000 (16:27 -0700)
committerQuentin Colombet <qcolombet@apple.com>
Thu, 8 Oct 2020 18:33:06 +0000 (11:33 -0700)
commitd421e0484afd9a951ddf8c986febaf9c3743dc0c
tree4d41aff1d420b5f782e154b2ee517ea876f89416
parent9431f8ad2e033b3c7629ff74fe41d7c42a9554f8
[KnownBits] Add a sextOrTrunc method

We already offer zextOrTrunc and it seems natural to offer the
same capability for sign extension.

This patch is a preparatory addition useful for future computeKnownBits
developments.

Differential Revision: https://reviews.llvm.org/D88937
llvm/include/llvm/Support/KnownBits.h
llvm/unittests/Support/KnownBitsTest.cpp