diff options
author | Chris Lattner <sabre@nondot.org> | 2005-01-08 19:42:22 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2005-01-08 19:42:22 +0000 |
commit | 652f3cf76f7b1a8141e65a902b3e18082b34efed (patch) | |
tree | 71723053792b759e1fe314092f19972f9e3285d5 | |
parent | d4bc564531ec9d7db7ec6630bc89f411f730cda1 (diff) |
Fix uint64_t -> unsigned VS warnings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19381 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Transforms/Scalar/DeadStoreElimination.cpp | 4 | ||||
-rw-r--r-- | lib/Transforms/Scalar/InstructionCombining.cpp | 21 |
2 files changed, 13 insertions, 12 deletions
diff --git a/lib/Transforms/Scalar/DeadStoreElimination.cpp b/lib/Transforms/Scalar/DeadStoreElimination.cpp index e29bad53c1..5afcd70bd9 100644 --- a/lib/Transforms/Scalar/DeadStoreElimination.cpp +++ b/lib/Transforms/Scalar/DeadStoreElimination.cpp @@ -73,7 +73,7 @@ bool DSE::runOnBasicBlock(BasicBlock &BB) { unsigned Size = ~0U; if (!AI->isArrayAllocation() && AI->getType()->getElementType()->isSized()) - Size = TD.getTypeSize(AI->getType()->getElementType()); + Size = (unsigned)TD.getTypeSize(AI->getType()->getElementType()); KillLocs.add(AI, Size); } } @@ -106,7 +106,7 @@ bool DSE::runOnBasicBlock(BasicBlock &BB) { // the stored location is already in the tracker, then this is a dead // store. We can just delete it here, but while we're at it, we also // delete any trivially dead expression chains. - unsigned ValSize = TD.getTypeSize(I->getOperand(0)->getType()); + unsigned ValSize = (unsigned)TD.getTypeSize(I->getOperand(0)->getType()); Value *Ptr = I->getOperand(1); if (AliasSet *AS = KillLocs.getAliasSetForPointerIfExists(Ptr, ValSize)) diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index 98f9846624..3ab7be5f85 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/lib/Transforms/Scalar/InstructionCombining.cpp @@ -2274,7 +2274,7 @@ Instruction *InstCombiner::visitSetCondInst(BinaryOperator &I) { if (LHSI->hasOneUse()) { // Otherwise strength reduce the shift into an and. - unsigned ShAmtVal = ShAmt->getValue(); + unsigned ShAmtVal = (unsigned)ShAmt->getValue(); unsigned TypeBits = CI->getType()->getPrimitiveSize()*8; uint64_t Val = (1ULL << (TypeBits-ShAmtVal))-1; @@ -2317,7 +2317,7 @@ Instruction *InstCombiner::visitSetCondInst(BinaryOperator &I) { } if (LHSI->hasOneUse() || CI->isNullValue()) { - unsigned ShAmtVal = ShAmt->getValue(); + unsigned ShAmtVal = (unsigned)ShAmt->getValue(); // Otherwise strength reduce the shift into an and. uint64_t Val = ~0ULL; // All ones. @@ -2931,8 +2931,8 @@ Instruction *InstCombiner::visitShiftInst(ShiftInst &I) { if (ShiftInst *Op0SI = dyn_cast<ShiftInst>(Op0)) if (ConstantUInt *ShiftAmt1C = dyn_cast<ConstantUInt>(Op0SI->getOperand(1))) { - unsigned ShiftAmt1 = ShiftAmt1C->getValue(); - unsigned ShiftAmt2 = CUI->getValue(); + unsigned ShiftAmt1 = (unsigned)ShiftAmt1C->getValue(); + unsigned ShiftAmt2 = (unsigned)CUI->getValue(); // Check for (A << c1) << c2 and (A >> c1) >> c2 if (I.getOpcode() == Op0SI->getOpcode()) { @@ -3169,8 +3169,8 @@ Instruction *InstCombiner::visitCastInst(CastInst &CI) { const Type *AllocElTy = AI->getAllocatedType(); const Type *CastElTy = PTy->getElementType(); if (AllocElTy->isSized() && CastElTy->isSized()) { - unsigned AllocElTySize = TD->getTypeSize(AllocElTy); - unsigned CastElTySize = TD->getTypeSize(CastElTy); + uint64_t AllocElTySize = TD->getTypeSize(AllocElTy); + uint64_t CastElTySize = TD->getTypeSize(CastElTy); // If the allocation is for an even multiple of the cast type size if (CastElTySize && (AllocElTySize % CastElTySize == 0)) { @@ -4190,12 +4190,13 @@ static Constant *GetGEPGlobalInitializer(Constant *C, ConstantExpr *CE) { ConstantUInt *CU = cast<ConstantUInt>(I.getOperand()); assert(CU->getValue() < STy->getNumElements() && "Struct index out of range!"); + unsigned El = (unsigned)CU->getValue(); if (ConstantStruct *CS = dyn_cast<ConstantStruct>(C)) { - C = CS->getOperand(CU->getValue()); + C = CS->getOperand(El); } else if (isa<ConstantAggregateZero>(C)) { - C = Constant::getNullValue(STy->getElementType(CU->getValue())); + C = Constant::getNullValue(STy->getElementType(El)); } else if (isa<UndefValue>(C)) { - C = UndefValue::get(STy->getElementType(CU->getValue())); + C = UndefValue::get(STy->getElementType(El)); } else { return 0; } @@ -4203,7 +4204,7 @@ static Constant *GetGEPGlobalInitializer(Constant *C, ConstantExpr *CE) { const ArrayType *ATy = cast<ArrayType>(*I); if ((uint64_t)CI->getRawValue() >= ATy->getNumElements()) return 0; if (ConstantArray *CA = dyn_cast<ConstantArray>(C)) - C = CA->getOperand(CI->getRawValue()); + C = CA->getOperand((unsigned)CI->getRawValue()); else if (isa<ConstantAggregateZero>(C)) C = Constant::getNullValue(ATy->getElementType()); else if (isa<UndefValue>(C)) |