aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp
diff options
context:
space:
mode:
authorJay Foad <jay.foad@amd.com>2021-10-06 10:54:07 +0100
committerJay Foad <jay.foad@amd.com>2022-05-19 11:23:13 +0100
commit6bec3e9303d68b8b264de3a02ca943d9dd752004 (patch)
tree22895b5da18d7260d5d898c348c795ab7840d718 /llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp
parent70ace420c1f09447a07f0d93d73284a15cfa198a (diff)
downloadllvm-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/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp b/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp
index 5ed55b0..aa9c77f 100644
--- a/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp
@@ -466,9 +466,9 @@ void FunctionLoweringInfo::ComputePHILiveOutRegInfo(const PHINode *PN) {
if (ConstantInt *CI = dyn_cast<ConstantInt>(V)) {
APInt Val;
if (TLI->signExtendConstant(CI))
- Val = CI->getValue().sextOrSelf(BitWidth);
+ Val = CI->getValue().sext(BitWidth);
else
- Val = CI->getValue().zextOrSelf(BitWidth);
+ Val = CI->getValue().zext(BitWidth);
DestLOI.NumSignBits = Val.getNumSignBits();
DestLOI.Known = KnownBits::makeConstant(Val);
} else {
@@ -502,9 +502,9 @@ void FunctionLoweringInfo::ComputePHILiveOutRegInfo(const PHINode *PN) {
if (ConstantInt *CI = dyn_cast<ConstantInt>(V)) {
APInt Val;
if (TLI->signExtendConstant(CI))
- Val = CI->getValue().sextOrSelf(BitWidth);
+ Val = CI->getValue().sext(BitWidth);
else
- Val = CI->getValue().zextOrSelf(BitWidth);
+ Val = CI->getValue().zext(BitWidth);
DestLOI.NumSignBits = std::min(DestLOI.NumSignBits, Val.getNumSignBits());
DestLOI.Known.Zero &= ~Val;
DestLOI.Known.One &= Val;