diff options
Diffstat (limited to 'llvm/lib/VMCore')
-rw-r--r-- | llvm/lib/VMCore/ConstantFold.cpp | 4 | ||||
-rw-r--r-- | llvm/lib/VMCore/Constants.cpp | 35 | ||||
-rw-r--r-- | llvm/lib/VMCore/Core.cpp | 22 |
3 files changed, 1 insertions, 60 deletions
diff --git a/llvm/lib/VMCore/ConstantFold.cpp b/llvm/lib/VMCore/ConstantFold.cpp index 701a195f7fd..a8694672456 100644 --- a/llvm/lib/VMCore/ConstantFold.cpp +++ b/llvm/lib/VMCore/ConstantFold.cpp @@ -122,9 +122,7 @@ static Constant *FoldBitCast(LLVMContext &Context, } if (ElTy == DPTy->getElementType()) - // This GEP is inbounds because all indices are zero. - return ConstantExpr::getInBoundsGetElementPtr(V, &IdxList[0], - IdxList.size()); + return ConstantExpr::getGetElementPtr(V, &IdxList[0], IdxList.size()); } // Handle casts from one vector constant to another. We know that the src diff --git a/llvm/lib/VMCore/Constants.cpp b/llvm/lib/VMCore/Constants.cpp index 37efafc9b20..1ddc1e27b0e 100644 --- a/llvm/lib/VMCore/Constants.cpp +++ b/llvm/lib/VMCore/Constants.cpp @@ -631,24 +631,6 @@ Constant* ConstantVector::get(Constant* const* Vals, unsigned NumVals) { return get(std::vector<Constant*>(Vals, Vals+NumVals)); } -Constant* ConstantExpr::getNSWAdd(Constant* C1, Constant* C2) { - Constant *C = getAdd(C1, C2); - // Set nsw attribute, assuming constant folding didn't eliminate the - // Add. - if (AddOperator *Add = dyn_cast<AddOperator>(C)) - Add->setHasNoSignedWrap(true); - return C; -} - -Constant* ConstantExpr::getExactSDiv(Constant* C1, Constant* C2) { - Constant *C = getSDiv(C1, C2); - // Set exact attribute, assuming constant folding didn't eliminate the - // SDiv. - if (SDivOperator *SDiv = dyn_cast<SDivOperator>(C)) - SDiv->setIsExact(true); - return C; -} - // Utility function for determining if a ConstantExpr is a CastOp or not. This // can't be inline because we don't want to #include Instruction.h into // Constant.h @@ -1491,28 +1473,11 @@ Constant *ConstantExpr::getGetElementPtr(Constant *C, Value* const *Idxs, return getGetElementPtrTy(PointerType::get(Ty, As), C, Idxs, NumIdx); } -Constant *ConstantExpr::getInBoundsGetElementPtr(Constant *C, - Value* const *Idxs, - unsigned NumIdx) { - Constant *Result = getGetElementPtr(C, Idxs, NumIdx); - // Set in bounds attribute, assuming constant folding didn't eliminate the - // GEP. - if (GEPOperator *GEP = dyn_cast<GEPOperator>(Result)) - GEP->setIsInBounds(true); - return Result; -} - Constant *ConstantExpr::getGetElementPtr(Constant *C, Constant* const *Idxs, unsigned NumIdx) { return getGetElementPtr(C, (Value* const *)Idxs, NumIdx); } -Constant *ConstantExpr::getInBoundsGetElementPtr(Constant *C, - Constant* const *Idxs, - unsigned NumIdx) { - return getInBoundsGetElementPtr(C, (Value* const *)Idxs, NumIdx); -} - Constant * ConstantExpr::getICmp(unsigned short pred, Constant* LHS, Constant* RHS) { assert(LHS->getType() == RHS->getType()); diff --git a/llvm/lib/VMCore/Core.cpp b/llvm/lib/VMCore/Core.cpp index 1dbf5c44efc..240b27af32b 100644 --- a/llvm/lib/VMCore/Core.cpp +++ b/llvm/lib/VMCore/Core.cpp @@ -535,13 +535,6 @@ LLVMValueRef LLVMConstAdd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant) { unwrap<Constant>(RHSConstant))); } -LLVMValueRef LLVMConstNSWAdd(LLVMValueRef LHSConstant, - LLVMValueRef RHSConstant) { - return wrap(ConstantExpr::getNSWAdd( - unwrap<Constant>(LHSConstant), - unwrap<Constant>(RHSConstant))); -} - LLVMValueRef LLVMConstFAdd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant) { return wrap(ConstantExpr::getFAdd( unwrap<Constant>(LHSConstant), @@ -583,13 +576,6 @@ LLVMValueRef LLVMConstSDiv(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant) { unwrap<Constant>(RHSConstant))); } -LLVMValueRef LLVMConstExactSDiv(LLVMValueRef LHSConstant, - LLVMValueRef RHSConstant) { - return wrap(ConstantExpr::getExactSDiv( - unwrap<Constant>(LHSConstant), - unwrap<Constant>(RHSConstant))); -} - LLVMValueRef LLVMConstFDiv(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant) { return wrap(ConstantExpr::getFDiv( unwrap<Constant>(LHSConstant), @@ -673,14 +659,6 @@ LLVMValueRef LLVMConstGEP(LLVMValueRef ConstantVal, NumIndices)); } -LLVMValueRef LLVMConstInBoundsGEP(LLVMValueRef ConstantVal, - LLVMValueRef *ConstantIndices, - unsigned NumIndices) { - Constant* Val = unwrap<Constant>(ConstantVal); - Constant** Idxs = unwrap<Constant>(ConstantIndices, NumIndices); - return wrap(ConstantExpr::getInBoundsGetElementPtr(Val, Idxs, NumIndices)); -} - LLVMValueRef LLVMConstTrunc(LLVMValueRef ConstantVal, LLVMTypeRef ToType) { return wrap(ConstantExpr::getTrunc( unwrap<Constant>(ConstantVal), |