- // The remaining possibilities are lossless if the typeID of the source type
- // matches the type ID of the destination in size and fundamental type. This
- // prevents things like int -> ptr, int -> float, packed -> int, mismatched
- // packed types of the same size, and etc.
- switch (SrcTy->getTypeID()) {
- case Type::UByteTyID: return DstTy == Type::SByteTy;
- case Type::SByteTyID: return DstTy == Type::UByteTy;
- case Type::UShortTyID: return DstTy == Type::ShortTy;
- case Type::ShortTyID: return DstTy == Type::UShortTy;
- case Type::UIntTyID: return DstTy == Type::IntTy;
- case Type::IntTyID: return DstTy == Type::UIntTy;
- case Type::ULongTyID: return DstTy == Type::LongTy;
- case Type::LongTyID: return DstTy == Type::ULongTy;
- case Type::PointerTyID: return isa<PointerType>(DstTy);
- default:
- break;
- }
+ // Pointer to pointer is always lossless.
+ if (isa<PointerType>(SrcTy))
+ return isa<PointerType>(DstTy);