diff options
Diffstat (limited to 'llvm/lib/Analysis')
-rw-r--r-- | llvm/lib/Analysis/ConstantFolding.cpp | 4 | ||||
-rw-r--r-- | llvm/lib/Analysis/ValueTracking.cpp | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/Analysis/ConstantFolding.cpp b/llvm/lib/Analysis/ConstantFolding.cpp index 7ee716f..43b3af2 100644 --- a/llvm/lib/Analysis/ConstantFolding.cpp +++ b/llvm/lib/Analysis/ConstantFolding.cpp @@ -351,7 +351,7 @@ static bool ReadDataFromGlobal(Constant *C, uint64_t ByteOffset, uint64_t EltSize = CDS->getElementByteSize(); uint64_t Index = ByteOffset / EltSize; uint64_t Offset = ByteOffset - Index * EltSize; - for (; Index != CDS->getType()->getNumElements(); ++Index) { + for (unsigned e = CDS->getNumElements(); Index != e; ++Index) { if (!ReadDataFromGlobal(CDS->getElementAsConstant(Index), Offset, CurPtr, BytesLeft, TD)) return false; @@ -1042,7 +1042,7 @@ Constant *llvm::ConstantFoldLoadThroughGEPIndices(Constant *C, return 0; C = CA->getOperand(IdxVal); } else if (ConstantDataSequential *CDS=dyn_cast<ConstantDataSequential>(C)){ - if (IdxVal >= CDS->getType()->getNumElements()) + if (IdxVal >= CDS->getNumElements()) return 0; C = CDS->getElementAsConstant(IdxVal); } else if (ConstantVector *CV = dyn_cast<ConstantVector>(C)) { diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp index 753ec18..ca55fcb 100644 --- a/llvm/lib/Analysis/ValueTracking.cpp +++ b/llvm/lib/Analysis/ValueTracking.cpp @@ -105,7 +105,7 @@ void llvm::ComputeMaskedBits(Value *V, const APInt &Mask, // each element. KnownZero.setAllBits(); KnownOne.setAllBits(); APInt Elt(KnownZero.getBitWidth(), 0); - for (unsigned i = 0, e = CDS->getType()->getNumElements(); i != e; ++i) { + for (unsigned i = 0, e = CDS->getNumElements(); i != e; ++i) { Elt = CDS->getElementAsInteger(i); KnownZero &= ~Elt; KnownOne &= Elt; |