teach valuetracking about ConstantDataSequential

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148790 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2012-01-24 07:54:10 +00:00
parent dada586f16
commit df39028607
3 changed files with 75 additions and 33 deletions

View File

@@ -624,6 +624,15 @@ Constant *ConstantAggregateZero::getElementValue(Constant *C) {
return getStructElement(cast<ConstantInt>(C)->getZExtValue());
}
/// getElementValue - Return a zero of the right value for the specified GEP
/// index.
Constant *ConstantAggregateZero::getElementValue(unsigned Idx) {
if (isa<SequentialType>(getType()))
return getSequentialElement();
return getStructElement(Idx);
}
//===----------------------------------------------------------------------===//
// UndefValue Implementation
//===----------------------------------------------------------------------===//
@@ -648,6 +657,15 @@ UndefValue *UndefValue::getElementValue(Constant *C) {
return getStructElement(cast<ConstantInt>(C)->getZExtValue());
}
/// getElementValue - Return an undef of the right value for the specified GEP
/// index.
UndefValue *UndefValue::getElementValue(unsigned Idx) {
if (isa<SequentialType>(getType()))
return getSequentialElement();
return getStructElement(Idx);
}
//===----------------------------------------------------------------------===//
// ConstantXXX Classes