]> granicus.if.org Git - llvm/commitdiff
[ConstantInt] Use ConstantInt::getValue instead of Constant::getUniqueInteger in...
authorCraig Topper <craig.topper@intel.com>
Fri, 4 Aug 2017 16:59:29 +0000 (16:59 +0000)
committerCraig Topper <craig.topper@intel.com>
Fri, 4 Aug 2017 16:59:29 +0000 (16:59 +0000)
getUniqueInteger will ultimately call ConstantInt::getValue, but calling ConstantInt::getValue should be inlined.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310069 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/BranchProbabilityInfo.cpp
lib/Analysis/LazyValueInfo.cpp
lib/Target/AArch64/AArch64ISelLowering.cpp

index 3748c651fd27dd9bd964b6130e82e4a77d7eb21e..6008c353a086936d2efb378d8cc9a947f884421f 100644 (file)
@@ -496,7 +496,7 @@ bool BranchProbabilityInfo::calcZeroHeuristics(const BasicBlock *BB,
   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
index e6b013f79a7aa2586e7c0e40563d58917ee9402c..e72eedeaabed3b338ed79bda07d3a0b90fb8b219 100644 (file)
@@ -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(Value *Val, Value *Op,
     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(Value *Val, Value *Op,
     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();
index b1a2e363f53761ca28ea888f72aecfe6b57e2aa4..784cdd9c7be313c3cec20c8d4792aa98b338a4b7 100644 (file)
@@ -10762,7 +10762,7 @@ bool AArch64TargetLowering::isMaskAndCmp0FoldingBeneficial(
   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 {