diff options
| author | Duncan Sands <baldrick@free.fr> | 2012-10-29 17:31:46 +0000 |
|---|---|---|
| committer | Duncan Sands <baldrick@free.fr> | 2012-10-29 17:31:46 +0000 |
| commit | 5bdd9dda48fd6f994148a25d6211c581b9ced787 (patch) | |
| tree | 63ebe4ebf6b803ca72a710de0da5d79a1ef2c301 /llvm/lib/VMCore/DataLayout.cpp | |
| parent | 09d16aa87e594afa0a8798748d13fb185cb25b31 (diff) | |
| download | bcm5719-llvm-5bdd9dda48fd6f994148a25d6211c581b9ced787.tar.gz bcm5719-llvm-5bdd9dda48fd6f994148a25d6211c581b9ced787.zip | |
Remove a wrapper around getIntPtrType added to GVN by Hal in commit 166624 (the
wrapper returns a vector of integers when passed a vector of pointers) by having
getIntPtrType itself return a vector of integers in this case. Outside of this
wrapper, I didn't find anywhere in the codebase that was relying on the old
behaviour for vectors of pointers, so give this a whirl through the buildbots.
llvm-svn: 166939
Diffstat (limited to 'llvm/lib/VMCore/DataLayout.cpp')
| -rw-r--r-- | llvm/lib/VMCore/DataLayout.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/llvm/lib/VMCore/DataLayout.cpp b/llvm/lib/VMCore/DataLayout.cpp index b8474927194..7c9284f9b80 100644 --- a/llvm/lib/VMCore/DataLayout.cpp +++ b/llvm/lib/VMCore/DataLayout.cpp @@ -668,18 +668,22 @@ unsigned DataLayout::getPreferredTypeAlignmentShift(Type *Ty) const { return Log2_32(Align); } -/// getIntPtrType - Return an integer type that is the same size or -/// greater to the pointer size for the address space. +/// getIntPtrType - Return an integer type with size at least as big as that +/// of a pointer in the given address space. IntegerType *DataLayout::getIntPtrType(LLVMContext &C, unsigned AddressSpace) const { return IntegerType::get(C, getPointerSizeInBits(AddressSpace)); } -/// getIntPtrType - Return an integer type that is the same size or -/// greater to the pointer size of the specific PointerType. -IntegerType *DataLayout::getIntPtrType(Type *Ty) const { +/// getIntPtrType - Return an integer (vector of integer) type with size at +/// least as big as that of a pointer of the given pointer (vector of pointer) +/// type. +Type *DataLayout::getIntPtrType(Type *Ty) const { unsigned NumBits = getPointerTypeSizeInBits(Ty); - return IntegerType::get(Ty->getContext(), NumBits); + IntegerType *IntTy = IntegerType::get(Ty->getContext(), NumBits); + if (VectorType *VecTy = dyn_cast<VectorType>(Ty)) + return VectorType::get(IntTy, VecTy->getNumElements()); + return IntTy; } |

