[llvm-commits] [PATCH] update getPointerTo to handle multiple address spaces

Duncan Sands baldrick at free.fr
Tue Oct 30 07:02:55 PDT 2012


Hi Micah,

On 30/10/12 14:55, Micah Villmow wrote:
>    This is an updated version of the patch that provides an assertion that using certain functions only occurs with certain types.

I strongly disagree with these changes:

> @@ -679,10 +676,15 @@
>  /// 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);
> +  unsigned NumBits = 0;
> +  if ((Ty->isVectorTy() && Ty->getVectorElementType()->isPointerTy()) ||
> +      Ty->isPointerTy())
> +    NumBits = getPointerTypeSizeInBits(Ty);
> +  else
> +    NumBits = getTypeSizeInBits(Ty);
>    IntegerType *IntTy = IntegerType::get(Ty->getContext(), NumBits);
> -  if (VectorType *VecTy = dyn_cast<VectorType>(Ty))
> -    return VectorType::get(IntTy, VecTy->getNumElements());
> +  if (Ty->isVectorTy())
> +    return VectorType::get(IntTy,Ty->getVectorNumElements());
>    return IntTy;
>  }

Once more you are trying to handle the case when the passed in value is not a
pointer.  It's just wrong, please stop trying to do this.

Ciao, Duncan.



More information about the llvm-commits mailing list