Support getelementptr instructions which use uint's to index into structure
types and can have arbitrary 32- and 64-bit integer types indexing into
sequential types.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12653 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Transforms/LevelRaise.cpp b/lib/Transforms/LevelRaise.cpp
index edc42b7..aeb836d 100644
--- a/lib/Transforms/LevelRaise.cpp
+++ b/lib/Transforms/LevelRaise.cpp
@@ -370,9 +370,8 @@
// Build the index vector, full of all zeros
std::vector<Value*> Indices;
- Indices.push_back(ConstantSInt::get(Type::LongTy, 0)); // FIXME, PR82
+ Indices.push_back(Constant::getNullValue(Type::UIntTy));
while (CurCTy && !isa<PointerType>(CurCTy)) {
- const Type *IdxType;
if (const StructType *CurSTy = dyn_cast<StructType>(CurCTy)) {
// Check for a zero element struct type... if we have one, bail.
if (CurSTy->getNumElements() == 0) break;
@@ -381,14 +380,12 @@
// offset zero in the struct.
//
ElTy = CurSTy->getElementType(0);
- IdxType = Type::UByteTy; // FIXME when PR82 is fixed.
} else {
ElTy = cast<ArrayType>(CurCTy)->getElementType();
- IdxType = Type::LongTy; // FIXME when PR82 is fixed.
}
// Insert a zero to index through this type...
- Indices.push_back(Constant::getNullValue(IdxType));
+ Indices.push_back(Constant::getNullValue(Type::UIntTy));
// Did we find what we're looking for?
if (ElTy->isLosslesslyConvertibleTo(DestPointedTy)) break;