summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2012-01-25 01:27:20 +0000
committerChris Lattner <sabre@nondot.org>2012-01-25 01:27:20 +0000
commit9be59599b3b17be04d92a86b4bc11631e554a0d5 (patch)
treead99cba3a715c18d491c21467b2be9a7677e52b3 /llvm/lib/Analysis
parentdd99ec8ccf542bfde5fe60eb23ad58e5bbf1b790 (diff)
downloadbcm5719-llvm-9be59599b3b17be04d92a86b4bc11631e554a0d5.tar.gz
bcm5719-llvm-9be59599b3b17be04d92a86b4bc11631e554a0d5.zip
Use the right method to get the # elements in a CDS.
llvm-svn: 148897
Diffstat (limited to 'llvm/lib/Analysis')
-rw-r--r--llvm/lib/Analysis/ConstantFolding.cpp4
-rw-r--r--llvm/lib/Analysis/ValueTracking.cpp2
2 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/Analysis/ConstantFolding.cpp b/llvm/lib/Analysis/ConstantFolding.cpp
index 7ee716fdf62..43b3af2ac52 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 753ec189944..ca55fcbc6ed 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;
OpenPOWER on IntegriCloud