[llvm] r310069 - [ConstantInt] Use ConstantInt::getValue instead of Constant::getUniqueInteger in a few places where we obviously have a ConstantInt. NFC
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 4 09:59:30 PDT 2017
Author: ctopper
Date: Fri Aug 4 09:59:29 2017
New Revision: 310069
URL: http://llvm.org/viewvc/llvm-project?rev=310069&view=rev
Log:
[ConstantInt] Use ConstantInt::getValue instead of Constant::getUniqueInteger in a few places where we obviously have a ConstantInt. NFC
getUniqueInteger will ultimately call ConstantInt::getValue, but calling ConstantInt::getValue should be inlined.
Modified:
llvm/trunk/lib/Analysis/BranchProbabilityInfo.cpp
llvm/trunk/lib/Analysis/LazyValueInfo.cpp
llvm/trunk/lib/Target/AArch64/AArch64ISelLowering.cpp
Modified: llvm/trunk/lib/Analysis/BranchProbabilityInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/BranchProbabilityInfo.cpp?rev=310069&r1=310068&r2=310069&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/BranchProbabilityInfo.cpp (original)
+++ llvm/trunk/lib/Analysis/BranchProbabilityInfo.cpp Fri Aug 4 09:59:29 2017
@@ -496,7 +496,7 @@ bool BranchProbabilityInfo::calcZeroHeur
if (Instruction *LHS = dyn_cast<Instruction>(CI->getOperand(0)))
if (LHS->getOpcode() == Instruction::And)
if (ConstantInt *AndRHS = dyn_cast<ConstantInt>(LHS->getOperand(1)))
- if (AndRHS->getUniqueInteger().isPowerOf2())
+ if (AndRHS->getValue().isPowerOf2())
return false;
// Check if the LHS is the return value of a library function
Modified: llvm/trunk/lib/Analysis/LazyValueInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/LazyValueInfo.cpp?rev=310069&r1=310068&r2=310069&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/LazyValueInfo.cpp (original)
+++ llvm/trunk/lib/Analysis/LazyValueInfo.cpp Fri Aug 4 09:59:29 2017
@@ -151,7 +151,7 @@ public:
Optional<APInt> asConstantInteger() const {
if (isConstant() && isa<ConstantInt>(Val)) {
- return Val->getUniqueInteger();
+ return cast<ConstantInt>(Val)->getValue();
} else if (isConstantRange() && Range.isSingleElement()) {
return *Range.getSingleElement();
}
@@ -1384,7 +1384,7 @@ static LVILatticeVal constantFoldUser(Va
if (auto *C = dyn_cast_or_null<ConstantInt>(
SimplifyCastInst(CI->getOpcode(), OpConst,
CI->getDestTy(), DL))) {
- return LVILatticeVal::getRange(ConstantRange(C->getUniqueInteger()));
+ return LVILatticeVal::getRange(ConstantRange(C->getValue()));
}
} else if (auto *BO = dyn_cast<BinaryOperator>(Val)) {
bool Op0Match = BO->getOperand(0) == Op;
@@ -1395,7 +1395,7 @@ static LVILatticeVal constantFoldUser(Va
Value *RHS = Op1Match ? OpConst : BO->getOperand(1);
if (auto *C = dyn_cast_or_null<ConstantInt>(
SimplifyBinOp(BO->getOpcode(), LHS, RHS, DL))) {
- return LVILatticeVal::getRange(ConstantRange(C->getUniqueInteger()));
+ return LVILatticeVal::getRange(ConstantRange(C->getValue()));
}
}
return LVILatticeVal::getOverdefined();
Modified: llvm/trunk/lib/Target/AArch64/AArch64ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/AArch64ISelLowering.cpp?rev=310069&r1=310068&r2=310069&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AArch64/AArch64ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/AArch64/AArch64ISelLowering.cpp Fri Aug 4 09:59:29 2017
@@ -10762,7 +10762,7 @@ bool AArch64TargetLowering::isMaskAndCmp
ConstantInt* Mask = dyn_cast<ConstantInt>(AndI.getOperand(1));
if (!Mask)
return false;
- return Mask->getUniqueInteger().isPowerOf2();
+ return Mask->getValue().isPowerOf2();
}
void AArch64TargetLowering::initializeSplitCSR(MachineBasicBlock *Entry) const {
More information about the llvm-commits
mailing list