diff options
author | Jay Foad <jay.foad@amd.com> | 2021-10-06 10:54:07 +0100 |
---|---|---|
committer | Jay Foad <jay.foad@amd.com> | 2022-05-19 11:23:13 +0100 |
commit | 6bec3e9303d68b8b264de3a02ca943d9dd752004 (patch) | |
tree | 22895b5da18d7260d5d898c348c795ab7840d718 /llvm/lib/Support/APInt.cpp | |
parent | 70ace420c1f09447a07f0d93d73284a15cfa198a (diff) | |
download | llvm-6bec3e9303d68b8b264de3a02ca943d9dd752004.zip llvm-6bec3e9303d68b8b264de3a02ca943d9dd752004.tar.gz llvm-6bec3e9303d68b8b264de3a02ca943d9dd752004.tar.bz2 |
[APInt] Remove all uses of zextOrSelf, sextOrSelf and truncOrSelf
Most clients only used these methods because they wanted to be able to
extend or truncate to the same bit width (which is a no-op). Now that
the standard zext, sext and trunc allow this, there is no reason to use
the OrSelf versions.
The OrSelf versions additionally have the strange behaviour of allowing
extending to a *smaller* width, or truncating to a *larger* width, which
are also treated as no-ops. A small amount of client code relied on this
(ConstantRange::castOp and MicrosoftCXXNameMangler::mangleNumber) and
needed rewriting.
Differential Revision: https://reviews.llvm.org/D125557
Diffstat (limited to 'llvm/lib/Support/APInt.cpp')
-rw-r--r-- | llvm/lib/Support/APInt.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Support/APInt.cpp b/llvm/lib/Support/APInt.cpp index 3fc0415..ca8e8a5 100644 --- a/llvm/lib/Support/APInt.cpp +++ b/llvm/lib/Support/APInt.cpp @@ -343,7 +343,7 @@ void APInt::flipAllBitsSlowCase() { /// In the slow case, we know the result is large. APInt APInt::concatSlowCase(const APInt &NewLSB) const { unsigned NewWidth = getBitWidth() + NewLSB.getBitWidth(); - APInt Result = NewLSB.zextOrSelf(NewWidth); + APInt Result = NewLSB.zext(NewWidth); Result.insertBits(*this, NewLSB.getBitWidth()); return Result; } @@ -612,7 +612,7 @@ APInt APInt::getLoBits(unsigned numBits) const { APInt APInt::getSplat(unsigned NewLen, const APInt &V) { assert(NewLen >= V.getBitWidth() && "Can't splat to smaller bit width!"); - APInt Val = V.zextOrSelf(NewLen); + APInt Val = V.zext(NewLen); for (unsigned I = V.getBitWidth(); I < NewLen; I <<= 1) Val |= Val << I; |