diff options
author | Chris Lattner <sabre@nondot.org> | 2009-01-11 20:23:52 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-01-11 20:23:52 +0000 |
commit | 1c412d9ce48ef35f9ba516124e783384dcf58f08 (patch) | |
tree | 10ab811c067b87a2ee1d5b895c359d6c96aeddd8 | |
parent | dbc3bc258576672c26d32a0fb56437d87409dec1 (diff) |
do not generated GEPs into vectors where they don't already exist.
We should treat vectors as atomic types, not like arrays.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62046 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Transforms/Scalar/InstructionCombining.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index fd15f2e1ca..b6604a930d 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/lib/Transforms/Scalar/InstructionCombining.cpp @@ -7739,13 +7739,12 @@ static bool FindElementAtOffset(const Type *Ty, int64_t Offset, Offset -= SL->getElementOffset(Elt); Ty = STy->getElementType(Elt); - } else if (isa<ArrayType>(Ty) || isa<VectorType>(Ty)) { - const SequentialType *STy = cast<SequentialType>(Ty); - uint64_t EltSize = TD->getABITypeSize(STy->getElementType()); + } else if (const ArrayType *AT = dyn_cast<ArrayType>(Ty)) { + uint64_t EltSize = TD->getABITypeSize(AT->getElementType()); assert(EltSize && "Cannot index into a zero-sized array"); NewIndices.push_back(ConstantInt::get(IntPtrTy,Offset/EltSize)); Offset %= EltSize; - Ty = STy->getElementType(); + Ty = AT->getElementType(); } else { // Otherwise, we can't index into the middle of this atomic type, bail. return false; |