diff options
Diffstat (limited to 'lib/CodeGen')
-rw-r--r-- | lib/CodeGen/AsmPrinter.cpp | 23 | ||||
-rw-r--r-- | lib/CodeGen/IntrinsicLowering.cpp | 35 | ||||
-rw-r--r-- | lib/CodeGen/MachineDebugInfo.cpp | 29 | ||||
-rw-r--r-- | lib/CodeGen/SelectionDAG/LegalizeDAG.cpp | 6 | ||||
-rw-r--r-- | lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp | 70 |
5 files changed, 84 insertions, 79 deletions
diff --git a/lib/CodeGen/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter.cpp index 90d77adfb3..09978344a7 100644 --- a/lib/CodeGen/AsmPrinter.cpp +++ b/lib/CodeGen/AsmPrinter.cpp @@ -393,14 +393,15 @@ void AsmPrinter::EmitConstantValueOnly(const Constant *CV) { else if (const ConstantBool *CB = dyn_cast<ConstantBool>(CV)) { assert(CB->getValue()); O << "1"; - } else if (const ConstantSInt *CI = dyn_cast<ConstantSInt>(CV)) - if (((CI->getValue() << 32) >> 32) == CI->getValue()) - O << CI->getValue(); - else - O << (uint64_t)CI->getValue(); - else if (const ConstantUInt *CI = dyn_cast<ConstantUInt>(CV)) - O << CI->getValue(); - else if (const GlobalValue *GV = dyn_cast<GlobalValue>(CV)) { + } else if (const ConstantInt *CI = dyn_cast<ConstantInt>(CV)) { + if (CI->getType()->isSigned()) { + if (((CI->getSExtValue() << 32) >> 32) == CI->getSExtValue()) + O << CI->getSExtValue(); + else + O << (uint64_t)CI->getSExtValue(); + } else + O << CI->getZExtValue(); + } else if (const GlobalValue *GV = dyn_cast<GlobalValue>(CV)) { // This is a constant address for a global variable or function. Use the // name of the variable or function as the address value, possibly // decorating it with GlobalVarAddrPrefix/Suffix or @@ -492,7 +493,7 @@ static void printAsCString(std::ostream &O, const ConstantArray *CVA, O << "\""; for (unsigned i = 0; i != LastElt; ++i) { unsigned char C = - (unsigned char)cast<ConstantInt>(CVA->getOperand(i))->getRawValue(); + (unsigned char)cast<ConstantInt>(CVA->getOperand(i))->getZExtValue(); if (C == '"') { O << "\\\""; @@ -524,7 +525,7 @@ static void printAsCString(std::ostream &O, const ConstantArray *CVA, void AsmPrinter::EmitString(const ConstantArray *CVA) const { unsigned NumElts = CVA->getNumOperands(); if (TAI->getAscizDirective() && NumElts && - cast<ConstantInt>(CVA->getOperand(NumElts-1))->getRawValue() == 0) { + cast<ConstantInt>(CVA->getOperand(NumElts-1))->getZExtValue() == 0) { O << TAI->getAscizDirective(); printAsCString(O, CVA, NumElts-1); } else { @@ -604,7 +605,7 @@ void AsmPrinter::EmitGlobalConstant(const Constant *CV) { } } else if (CV->getType() == Type::ULongTy || CV->getType() == Type::LongTy) { if (const ConstantInt *CI = dyn_cast<ConstantInt>(CV)) { - uint64_t Val = CI->getRawValue(); + uint64_t Val = CI->getZExtValue(); if (TAI->getData64bitsDirective()) O << TAI->getData64bitsDirective() << Val << "\n"; diff --git a/lib/CodeGen/IntrinsicLowering.cpp b/lib/CodeGen/IntrinsicLowering.cpp index 515752e6b7..b5a03fc54d 100644 --- a/lib/CodeGen/IntrinsicLowering.cpp +++ b/lib/CodeGen/IntrinsicLowering.cpp @@ -166,10 +166,10 @@ static Value *LowerBSWAP(Value *V, Instruction *IP) { Value *Tmp1 = new ShiftInst(Instruction::Shr, V, ConstantInt::get(Type::UByteTy,24),"bswap.1", IP); Tmp3 = BinaryOperator::createAnd(Tmp3, - ConstantUInt::get(Type::UIntTy, 0xFF0000), + ConstantInt::get(Type::UIntTy, 0xFF0000), "bswap.and3", IP); Tmp2 = BinaryOperator::createAnd(Tmp2, - ConstantUInt::get(Type::UIntTy, 0xFF00), + ConstantInt::get(Type::UIntTy, 0xFF00), "bswap.and2", IP); Tmp4 = BinaryOperator::createOr(Tmp4, Tmp3, "bswap.or1", IP); Tmp2 = BinaryOperator::createOr(Tmp2, Tmp1, "bswap.or2", IP); @@ -194,23 +194,24 @@ static Value *LowerBSWAP(Value *V, Instruction *IP) { Value *Tmp1 = new ShiftInst(Instruction::Shr, V, ConstantInt::get(Type::UByteTy,56),"bswap.1", IP); Tmp7 = BinaryOperator::createAnd(Tmp7, - ConstantUInt::get(Type::ULongTy, 0xFF000000000000ULL), - "bswap.and7", IP); + ConstantInt::get(Type::ULongTy, + 0xFF000000000000ULL), + "bswap.and7", IP); Tmp6 = BinaryOperator::createAnd(Tmp6, - ConstantUInt::get(Type::ULongTy, 0xFF0000000000ULL), - "bswap.and6", IP); + ConstantInt::get(Type::ULongTy, 0xFF0000000000ULL), + "bswap.and6", IP); Tmp5 = BinaryOperator::createAnd(Tmp5, - ConstantUInt::get(Type::ULongTy, 0xFF00000000ULL), - "bswap.and5", IP); + ConstantInt::get(Type::ULongTy, 0xFF00000000ULL), + "bswap.and5", IP); Tmp4 = BinaryOperator::createAnd(Tmp4, - ConstantUInt::get(Type::ULongTy, 0xFF000000ULL), - "bswap.and4", IP); + ConstantInt::get(Type::ULongTy, 0xFF000000ULL), + "bswap.and4", IP); Tmp3 = BinaryOperator::createAnd(Tmp3, - ConstantUInt::get(Type::ULongTy, 0xFF0000ULL), - "bswap.and3", IP); + ConstantInt::get(Type::ULongTy, 0xFF0000ULL), + "bswap.and3", IP); Tmp2 = BinaryOperator::createAnd(Tmp2, - ConstantUInt::get(Type::ULongTy, 0xFF00ULL), - "bswap.and2", IP); + ConstantInt::get(Type::ULongTy, 0xFF00ULL), + "bswap.and2", IP); Tmp8 = BinaryOperator::createOr(Tmp8, Tmp7, "bswap.or1", IP); Tmp6 = BinaryOperator::createOr(Tmp6, Tmp5, "bswap.or2", IP); Tmp4 = BinaryOperator::createOr(Tmp4, Tmp3, "bswap.or3", IP); @@ -247,8 +248,8 @@ static Value *LowerCTPOP(Value *V, Instruction *IP) { unsigned BitSize = V->getType()->getPrimitiveSizeInBits(); for (unsigned i = 1, ct = 0; i != BitSize; i <<= 1, ++ct) { Value *MaskCst = - ConstantExpr::getCast(ConstantUInt::get(Type::ULongTy, - MaskValues[ct]), V->getType()); + ConstantExpr::getCast(ConstantInt::get(Type::ULongTy, MaskValues[ct]), + V->getType()); Value *LHS = BinaryOperator::createAnd(V, MaskCst, "cppop.and1", IP); Value *VShift = new ShiftInst(Instruction::Shr, V, ConstantInt::get(Type::UByteTy, i), "ctpop.sh", IP); @@ -395,7 +396,7 @@ void DefaultIntrinsicLowering::LowerIntrinsicCall(CallInst *CI) { case Intrinsic::readcyclecounter: { std::cerr << "WARNING: this target does not support the llvm.readcyclecoun" << "ter intrinsic. It is being lowered to a constant 0\n"; - CI->replaceAllUsesWith(ConstantUInt::get(Type::ULongTy, 0)); + CI->replaceAllUsesWith(ConstantInt::get(Type::ULongTy, 0)); break; } diff --git a/lib/CodeGen/MachineDebugInfo.cpp b/lib/CodeGen/MachineDebugInfo.cpp index 7ca63b0ba4..a1f4f1338b 100644 --- a/lib/CodeGen/MachineDebugInfo.cpp +++ b/lib/CodeGen/MachineDebugInfo.cpp @@ -120,7 +120,7 @@ static bool isGlobalVariable(Value *V) { /// getUIntOperand - Return ith operand if it is an unsigned integer. /// -static ConstantUInt *getUIntOperand(GlobalVariable *GV, unsigned i) { +static ConstantInt *getUIntOperand(GlobalVariable *GV, unsigned i) { // Make sure the GlobalVariable has an initializer. if (!GV->hasInitializer()) return NULL; @@ -133,8 +133,9 @@ static ConstantUInt *getUIntOperand(GlobalVariable *GV, unsigned i) { if (i >= N) return NULL; // Check constant. - return dyn_cast<ConstantUInt>(CI->getOperand(i)); + return dyn_cast<ConstantInt>(CI->getOperand(i)); } + //===----------------------------------------------------------------------===// /// ApplyToFields - Target the visitor to each field of the debug information @@ -192,19 +193,19 @@ public: /// virtual void Apply(int &Field) { Constant *C = CI->getOperand(I++); - Field = cast<ConstantSInt>(C)->getValue(); + Field = cast<ConstantInt>(C)->getSExtValue(); } virtual void Apply(unsigned &Field) { Constant *C = CI->getOperand(I++); - Field = cast<ConstantUInt>(C)->getValue(); + Field = cast<ConstantInt>(C)->getZExtValue(); } virtual void Apply(int64_t &Field) { Constant *C = CI->getOperand(I++); - Field = cast<ConstantSInt>(C)->getValue(); + Field = cast<ConstantInt>(C)->getSExtValue(); } virtual void Apply(uint64_t &Field) { Constant *C = CI->getOperand(I++); - Field = cast<ConstantUInt>(C)->getValue(); + Field = cast<ConstantInt>(C)->getZExtValue(); } virtual void Apply(bool &Field) { Constant *C = CI->getOperand(I++); @@ -261,16 +262,16 @@ public: /// Apply - Set the value of each of the fields. /// virtual void Apply(int &Field) { - Elements.push_back(ConstantSInt::get(Type::IntTy, Field)); + Elements.push_back(ConstantInt::get(Type::IntTy, int32_t(Field))); } virtual void Apply(unsigned &Field) { - Elements.push_back(ConstantUInt::get(Type::UIntTy, Field)); + Elements.push_back(ConstantInt::get(Type::UIntTy, uint32_t(Field))); } virtual void Apply(int64_t &Field) { - Elements.push_back(ConstantSInt::get(Type::LongTy, Field)); + Elements.push_back(ConstantInt::get(Type::LongTy, int64_t(Field))); } virtual void Apply(uint64_t &Field) { - Elements.push_back(ConstantUInt::get(Type::ULongTy, Field)); + Elements.push_back(ConstantInt::get(Type::ULongTy, uint64_t(Field))); } virtual void Apply(bool &Field) { Elements.push_back(ConstantBool::get(Field)); @@ -467,8 +468,8 @@ public: /// TagFromGlobal - Returns the tag number from a debug info descriptor /// GlobalVariable. Return DIIValid if operand is not an unsigned int. unsigned DebugInfoDesc::TagFromGlobal(GlobalVariable *GV) { - ConstantUInt *C = getUIntOperand(GV, 0); - return C ? ((unsigned)C->getValue() & ~LLVMDebugVersionMask) : + ConstantInt *C = getUIntOperand(GV, 0); + return C ? ((unsigned)C->getZExtValue() & ~LLVMDebugVersionMask) : (unsigned)DW_TAG_invalid; } @@ -476,8 +477,8 @@ unsigned DebugInfoDesc::TagFromGlobal(GlobalVariable *GV) { /// descriptor GlobalVariable. Return DIIValid if operand is not an unsigned /// int. unsigned DebugInfoDesc::VersionFromGlobal(GlobalVariable *GV) { - ConstantUInt *C = getUIntOperand(GV, 0); - return C ? ((unsigned)C->getValue() & LLVMDebugVersionMask) : + ConstantInt *C = getUIntOperand(GV, 0); + return C ? ((unsigned)C->getZExtValue() & LLVMDebugVersionMask) : (unsigned)DW_TAG_invalid; } diff --git a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp index 723177f97d..125e46c0ca 100644 --- a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp +++ b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp @@ -3562,7 +3562,7 @@ SDOperand SelectionDAGLegalize::ExpandBUILD_VECTOR(SDNode *Node) { CV.push_back(ConstantFP::get(OpNTy, V->getValue())); } else if (ConstantSDNode *V = dyn_cast<ConstantSDNode>(Node->getOperand(i))) { - CV.push_back(ConstantUInt::get(OpNTy, V->getValue())); + CV.push_back(ConstantInt::get(OpNTy, V->getValue())); } else { assert(Node->getOperand(i).getOpcode() == ISD::UNDEF); CV.push_back(UndefValue::get(OpNTy)); @@ -3915,7 +3915,7 @@ ExpandIntToFP(bool isSigned, MVT::ValueType DestTy, SDOperand Source) { SignSet, Four, Zero); uint64_t FF = 0x5f800000ULL; if (TLI.isLittleEndian()) FF <<= 32; - static Constant *FudgeFactor = ConstantUInt::get(Type::ULongTy, FF); + static Constant *FudgeFactor = ConstantInt::get(Type::ULongTy, FF); SDOperand CPIdx = DAG.getConstantPool(FudgeFactor, TLI.getPointerTy()); CPIdx = DAG.getNode(ISD::ADD, TLI.getPointerTy(), CPIdx, CstOffset); @@ -4046,7 +4046,7 @@ SDOperand SelectionDAGLegalize::ExpandLegalINT_TO_FP(bool isSigned, case MVT::i64: FF = 0x5F800000ULL; break; // 2^64 (as a float) } if (TLI.isLittleEndian()) FF <<= 32; - static Constant *FudgeFactor = ConstantUInt::get(Type::ULongTy, FF); + static Constant *FudgeFactor = ConstantInt::get(Type::ULongTy, FF); SDOperand CPIdx = DAG.getConstantPool(FudgeFactor, TLI.getPointerTy()); CPIdx = DAG.getNode(ISD::ADD, TLI.getPointerTy(), CPIdx, CstOffset); diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp index 7cf3f5cb0d..238ed97843 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp @@ -236,21 +236,22 @@ FunctionLoweringInfo::FunctionLoweringInfo(TargetLowering &tli, Function::iterator BB = Fn.begin(), EB = Fn.end(); for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ++I) if (AllocaInst *AI = dyn_cast<AllocaInst>(I)) - if (ConstantUInt *CUI = dyn_cast<ConstantUInt>(AI->getArraySize())) { + if (ConstantInt *CUI = dyn_cast<ConstantInt>(AI->getArraySize())) { const Type *Ty = AI->getAllocatedType(); uint64_t TySize = TLI.getTargetData()->getTypeSize(Ty); unsigned Align = std::max((unsigned)TLI.getTargetData()->getTypeAlignment(Ty), AI->getAlignment()); - // If the alignment of the value is smaller than the size of the value, - // and if the size of the value is particularly small (<= 8 bytes), - // round up to the size of the value for potentially better performance. + // If the alignment of the value is smaller than the size of the + // value, and if the size of the value is particularly small + // (<= 8 bytes), round up to the size of the value for potentially + // better performance. // // FIXME: This could be made better with a preferred alignment hook in // TargetData. It serves primarily to 8-byte align doubles for X86. if (Align < TySize && TySize <= 8) Align = TySize; - TySize *= CUI->getValue(); // Get total allocated size. + TySize *= CUI->getZExtValue(); // Get total allocated size. if (TySize == 0) TySize = 1; // Don't create zero-sized stack objects. StaticAllocaMap[AI] = MF.getFrameInfo()->CreateStackObject((unsigned)TySize, Align); @@ -393,11 +394,13 @@ class SelectionDAGLowering { /// The comparison function for sorting Case values. struct CaseCmp { bool operator () (const Case& C1, const Case& C2) { - if (const ConstantUInt* U1 = dyn_cast<const ConstantUInt>(C1.first)) - return U1->getValue() < cast<const ConstantUInt>(C2.first)->getValue(); + if (const ConstantInt* I1 = dyn_cast<const ConstantInt>(C1.first)) + if (I1->getType()->isUnsigned()) + return I1->getZExtValue() < + cast<const ConstantInt>(C2.first)->getZExtValue(); - const ConstantSInt* S1 = dyn_cast<const ConstantSInt>(C1.first); - return S1->getValue() < cast<const ConstantSInt>(C2.first)->getValue(); + return cast<const ConstantInt>(C1.first)->getSExtValue() < + cast<const ConstantInt>(C2.first)->getSExtValue(); } }; @@ -637,7 +640,7 @@ SDOperand SelectionDAGLowering::getValue(const Value *V) { return N = DAG.getNode(ISD::VBUILD_VECTOR,MVT::Vector,&Ops[0],Ops.size()); } else { // Canonicalize all constant ints to be unsigned. - return N = DAG.getConstant(cast<ConstantIntegral>(C)->getRawValue(),VT); + return N = DAG.getConstant(cast<ConstantIntegral>(C)->getZExtValue(),VT); } } @@ -930,8 +933,8 @@ void SelectionDAGLowering::visitSwitch(SwitchInst &I) { // lowering the switch to a binary tree of conditional branches. if (TLI.isOperationLegal(ISD::BRIND, TLI.getPointerTy()) && Cases.size() > 5) { - uint64_t First = cast<ConstantIntegral>(Cases.front().first)->getRawValue(); - uint64_t Last = cast<ConstantIntegral>(Cases.back().first)->getRawValue(); + uint64_t First =cast<ConstantIntegral>(Cases.front().first)->getZExtValue(); + uint64_t Last = cast<ConstantIntegral>(Cases.back().first)->getZExtValue(); double Density = (double)Cases.size() / (double)((Last - First) + 1ULL); if (Density >= 0.3125) { @@ -979,9 +982,8 @@ void SelectionDAGLowering::visitSwitch(SwitchInst &I) { // the default BB. std::vector<MachineBasicBlock*> DestBBs; uint64_t TEI = First; - for (CaseItr ii = Cases.begin(), ee = Cases.end(); ii != ee; ++TEI) - if (cast<ConstantIntegral>(ii->first)->getRawValue() == TEI) { + if (cast<ConstantIntegral>(ii->first)->getZExtValue() == TEI) { DestBBs.push_back(ii->second); ++ii; } else { @@ -1055,8 +1057,8 @@ void SelectionDAGLowering::visitSwitch(SwitchInst &I) { // rather than creating a leaf node for it. if ((LHSR.second - LHSR.first) == 1 && LHSR.first->first == CR.GE && - cast<ConstantIntegral>(C)->getRawValue() == - (cast<ConstantIntegral>(CR.GE)->getRawValue() + 1ULL)) { + cast<ConstantIntegral>(C)->getZExtValue() == + (cast<ConstantIntegral>(CR.GE)->getZExtValue() + 1ULL)) { LHSBB = LHSR.first->second; } else { LHSBB = new MachineBasicBlock(LLVMBB); @@ -1069,8 +1071,8 @@ void SelectionDAGLowering::visitSwitch(SwitchInst &I) { // is CR.LT - 1, then we can branch directly to the target block for // the current Case Value, rather than emitting a RHS leaf node for it. if ((RHSR.second - RHSR.first) == 1 && CR.LT && - cast<ConstantIntegral>(RHSR.first->first)->getRawValue() == - (cast<ConstantIntegral>(CR.LT)->getRawValue() - 1ULL)) { + cast<ConstantIntegral>(RHSR.first->first)->getZExtValue() == + (cast<ConstantIntegral>(CR.LT)->getZExtValue() - 1ULL)) { RHSBB = RHSR.first->second; } else { RHSBB = new MachineBasicBlock(LLVMBB); @@ -1259,7 +1261,7 @@ void SelectionDAGLowering::visitGetElementPtr(User &I) { OI != E; ++OI) { Value *Idx = *OI; if (const StructType *StTy = dyn_cast<StructType>(Ty)) { - unsigned Field = cast<ConstantUInt>(Idx)->getValue(); + unsigned Field = cast<ConstantInt>(Idx)->getZExtValue(); if (Field) { // N = N + Offset uint64_t Offset = TD->getStructLayout(StTy)->MemberOffsets[Field]; @@ -1272,13 +1274,14 @@ void SelectionDAGLowering::visitGetElementPtr(User &I) { // If this is a constant subscript, handle it quickly. if (ConstantInt *CI = dyn_cast<ConstantInt>(Idx)) { - if (CI->getRawValue() == 0) continue; - + if (CI->getZExtValue() == 0) continue; uint64_t Offs; - if (ConstantSInt *CSI = dyn_cast<ConstantSInt>(CI)) - Offs = (int64_t)TD->getTypeSize(Ty)*CSI->getValue(); + if (CI->getType()->isSigned()) + Offs = (int64_t) + TD->getTypeSize(Ty)*cast<ConstantInt>(CI)->getSExtValue(); else - Offs = TD->getTypeSize(Ty)*cast<ConstantUInt>(CI)->getValue(); + Offs = + TD->getTypeSize(Ty)*cast<ConstantInt>(CI)->getZExtValue(); N = DAG.getNode(ISD::ADD, N.getValueType(), N, getIntPtrConstant(Offs)); continue; } @@ -2732,7 +2735,7 @@ SDOperand TargetLowering::CustomPromoteOperation(SDOperand Op, } void SelectionDAGLowering::visitFrameReturnAddress(CallInst &I, bool isFrame) { - unsigned Depth = (unsigned)cast<ConstantUInt>(I.getOperand(1))->getValue(); + unsigned Depth = (unsigned)cast<ConstantInt>(I.getOperand(1))->getZExtValue(); std::pair<SDOperand,SDOperand> Result = TLI.LowerFrameReturnAddress(isFrame, getRoot(), Depth, DAG); setValue(&I, Result.first); @@ -3126,7 +3129,7 @@ static bool OptimizeGEPExpression(GetElementPtrInst *GEPI, for (GetElementPtrInst::op_iterator OI = GEPI->op_begin()+1, E = GEPI->op_end(); OI != E; ++OI) { if (ConstantInt *CI = dyn_cast<ConstantInt>(*OI)) { - if (CI->getRawValue()) { + if (CI->getZExtValue()) { hasConstantIndex = true; break; } @@ -3159,7 +3162,7 @@ static bool OptimizeGEPExpression(GetElementPtrInst *GEPI, E = GEPI->op_end(); OI != E; ++OI) { Value *Idx = *OI; if (const StructType *StTy = dyn_cast<StructType>(Ty)) { - unsigned Field = cast<ConstantUInt>(Idx)->getValue(); + unsigned Field = cast<ConstantInt>(Idx)->getZExtValue(); if (Field) ConstantOffset += TD->getStructLayout(StTy)->MemberOffsets[Field]; Ty = StTy->getElementType(Field); @@ -3168,12 +3171,11 @@ static bool OptimizeGEPExpression(GetElementPtrInst *GEPI, // Handle constant subscripts. if (ConstantInt *CI = dyn_cast<ConstantInt>(Idx)) { - if (CI->getRawValue() == 0) continue; - - if (ConstantSInt *CSI = dyn_cast<ConstantSInt>(CI)) - ConstantOffset += (int64_t)TD->getTypeSize(Ty)*CSI->getValue(); + if (CI->getZExtValue() == 0) continue; + if (CI->getType()->isSigned()) + ConstantOffset += (int64_t)TD->getTypeSize(Ty)*CI->getSExtValue(); else - ConstantOffset+=TD->getTypeSize(Ty)*cast<ConstantUInt>(CI)->getValue(); + ConstantOffset += TD->getTypeSize(Ty)*CI->getZExtValue(); continue; } @@ -3185,7 +3187,7 @@ static bool OptimizeGEPExpression(GetElementPtrInst *GEPI, uint64_t ElementSize = TD->getTypeSize(Ty); // Mask off bits that should not be set. ElementSize &= ~0ULL >> (64-UIntPtrTy->getPrimitiveSizeInBits()); - Constant *SizeCst = ConstantUInt::get(UIntPtrTy, ElementSize); + Constant *SizeCst = ConstantInt::get(UIntPtrTy, ElementSize); // Multiply by the element size and add to the base. Idx = BinaryOperator::createMul(Idx, SizeCst, "", GEPI); @@ -3195,7 +3197,7 @@ static bool OptimizeGEPExpression(GetElementPtrInst *GEPI, // Make sure that the offset fits in uintptr_t. ConstantOffset &= ~0ULL >> (64-UIntPtrTy->getPrimitiveSizeInBits()); - Constant *PtrOffset = ConstantUInt::get(UIntPtrTy, ConstantOffset); + Constant *PtrOffset = ConstantInt::get(UIntPtrTy, ConstantOffset); // Okay, we have now emitted all of the variable index parts to the BB that // the GEP is defined in. Loop over all of the using instructions, inserting |