From: Craig Topper Date: Fri, 4 Aug 2017 16:59:29 +0000 (+0000) Subject: [ConstantInt] Use ConstantInt::getValue instead of Constant::getUniqueInteger in... X-Git-Tag: llvmorg-6.0.0-rc1~10890 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4e22ee6745d12c935ee29cb1fbc99d753adf125f;p=platform%2Fupstream%2Fllvm.git [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. llvm-svn: 310069 --- diff --git a/llvm/lib/Analysis/BranchProbabilityInfo.cpp b/llvm/lib/Analysis/BranchProbabilityInfo.cpp index 3748c65..6008c35 100644 --- a/llvm/lib/Analysis/BranchProbabilityInfo.cpp +++ b/llvm/lib/Analysis/BranchProbabilityInfo.cpp @@ -496,7 +496,7 @@ bool BranchProbabilityInfo::calcZeroHeuristics(const BasicBlock *BB, if (Instruction *LHS = dyn_cast(CI->getOperand(0))) if (LHS->getOpcode() == Instruction::And) if (ConstantInt *AndRHS = dyn_cast(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 diff --git a/llvm/lib/Analysis/LazyValueInfo.cpp b/llvm/lib/Analysis/LazyValueInfo.cpp index e6b013f..e72eede 100644 --- a/llvm/lib/Analysis/LazyValueInfo.cpp +++ b/llvm/lib/Analysis/LazyValueInfo.cpp @@ -151,7 +151,7 @@ public: Optional asConstantInteger() const { if (isConstant() && isa(Val)) { - return Val->getUniqueInteger(); + return cast(Val)->getValue(); } else if (isConstantRange() && Range.isSingleElement()) { return *Range.getSingleElement(); } @@ -1384,7 +1384,7 @@ static LVILatticeVal constantFoldUser(Value *Val, Value *Op, if (auto *C = dyn_cast_or_null( 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(Val)) { bool Op0Match = BO->getOperand(0) == Op; @@ -1395,7 +1395,7 @@ static LVILatticeVal constantFoldUser(Value *Val, Value *Op, Value *RHS = Op1Match ? OpConst : BO->getOperand(1); if (auto *C = dyn_cast_or_null( SimplifyBinOp(BO->getOpcode(), LHS, RHS, DL))) { - return LVILatticeVal::getRange(ConstantRange(C->getUniqueInteger())); + return LVILatticeVal::getRange(ConstantRange(C->getValue())); } } return LVILatticeVal::getOverdefined(); diff --git a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp index b1a2e36..784cdd9c7 100644 --- a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp +++ b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp @@ -10762,7 +10762,7 @@ bool AArch64TargetLowering::isMaskAndCmp0FoldingBeneficial( ConstantInt* Mask = dyn_cast(AndI.getOperand(1)); if (!Mask) return false; - return Mask->getUniqueInteger().isPowerOf2(); + return Mask->getValue().isPowerOf2(); } void AArch64TargetLowering::initializeSplitCSR(MachineBasicBlock *Entry) const {