Index: libcxxabi/test/test_demangle.pass.cpp =================================================================== --- libcxxabi/test/test_demangle.pass.cpp +++ libcxxabi/test/test_demangle.pass.cpp @@ -21544,7 +21544,6 @@ {"_ZN4llvm8CastInst17CreateIntegerCastEPNS_5ValueEPKNS_4TypeEbRKNS_5TwineEPNS_10BasicBlockE", "llvm::CastInst::CreateIntegerCast(llvm::Value*, llvm::Type const*, bool, llvm::Twine const&, llvm::BasicBlock*)"}, {"_ZN4llvm8CastInst12CreateFPCastEPNS_5ValueEPKNS_4TypeERKNS_5TwineEPNS_11InstructionE", "llvm::CastInst::CreateFPCast(llvm::Value*, llvm::Type const*, llvm::Twine const&, llvm::Instruction*)"}, {"_ZN4llvm8CastInst12CreateFPCastEPNS_5ValueEPKNS_4TypeERKNS_5TwineEPNS_10BasicBlockE", "llvm::CastInst::CreateFPCast(llvm::Value*, llvm::Type const*, llvm::Twine const&, llvm::BasicBlock*)"}, - {"_ZN4llvm8CastInst10isCastableEPKNS_4TypeES3_", "llvm::CastInst::isCastable(llvm::Type const*, llvm::Type const*)"}, {"_ZN4llvm8CastInst13getCastOpcodeEPKNS_5ValueEbPKNS_4TypeEb", "llvm::CastInst::getCastOpcode(llvm::Value const*, bool, llvm::Type const*, bool)"}, {"_ZN4llvm8CastInst11castIsValidENS_11Instruction7CastOpsEPNS_5ValueEPKNS_4TypeE", "llvm::CastInst::castIsValid(llvm::Instruction::CastOps, llvm::Value*, llvm::Type const*)"}, {"_ZN4llvm9TruncInstC2EPNS_5ValueEPKNS_4TypeERKNS_5TwineEPNS_11InstructionE", "llvm::TruncInst::TruncInst(llvm::Value*, llvm::Type const*, llvm::Twine const&, llvm::Instruction*)"}, Index: llvm/include/llvm/IR/InstrTypes.h =================================================================== --- llvm/include/llvm/IR/InstrTypes.h +++ llvm/include/llvm/IR/InstrTypes.h @@ -599,12 +599,6 @@ BasicBlock *InsertAtEnd ///< The block to insert the instruction into ); - /// Check whether it is valid to call getCastOpcode for these types. - static bool isCastable( - Type *SrcTy, ///< The Type from which the value should be cast. - Type *DestTy ///< The Type to which the value should be cast. - ); - /// Check whether a bitcast between these types is valid static bool isBitCastable( Type *SrcTy, ///< The Type from which the value should be cast. Index: llvm/lib/IR/Instructions.cpp =================================================================== --- llvm/lib/IR/Instructions.cpp +++ llvm/lib/IR/Instructions.cpp @@ -3142,64 +3142,6 @@ return Create(opcode, C, Ty, Name, InsertAtEnd); } -// Check whether it is valid to call getCastOpcode for these types. -// This routine must be kept in sync with getCastOpcode. -bool CastInst::isCastable(Type *SrcTy, Type *DestTy) { - if (!SrcTy->isFirstClassType() || !DestTy->isFirstClassType()) - return false; - - if (SrcTy == DestTy) - return true; - - if (VectorType *SrcVecTy = dyn_cast(SrcTy)) - if (VectorType *DestVecTy = dyn_cast(DestTy)) - if (cast(SrcVecTy)->getNumElements() == - cast(DestVecTy)->getNumElements()) { - // An element by element cast. Valid if casting the elements is valid. - SrcTy = SrcVecTy->getElementType(); - DestTy = DestVecTy->getElementType(); - } - - // Get the bit sizes, we'll need these - TypeSize SrcBits = SrcTy->getPrimitiveSizeInBits(); // 0 for ptr - TypeSize DestBits = DestTy->getPrimitiveSizeInBits(); // 0 for ptr - - // Run through the possibilities ... - if (DestTy->isIntegerTy()) { // Casting to integral - if (SrcTy->isIntegerTy()) // Casting from integral - return true; - if (SrcTy->isFloatingPointTy()) // Casting from floating pt - return true; - if (SrcTy->isVectorTy()) // Casting from vector - return DestBits == SrcBits; - // Casting from something else - return SrcTy->isPointerTy(); - } - if (DestTy->isFloatingPointTy()) { // Casting to floating pt - if (SrcTy->isIntegerTy()) // Casting from integral - return true; - if (SrcTy->isFloatingPointTy()) // Casting from floating pt - return true; - if (SrcTy->isVectorTy()) // Casting from vector - return DestBits == SrcBits; - // Casting from something else - return false; - } - if (DestTy->isVectorTy()) // Casting to vector - return DestBits == SrcBits; - if (DestTy->isPointerTy()) { // Casting to pointer - if (SrcTy->isPointerTy()) // Casting from pointer - return true; - return SrcTy->isIntegerTy(); // Casting from integral - } - if (DestTy->isX86_MMXTy()) { - if (SrcTy->isVectorTy()) - return DestBits == SrcBits; // 64-bit vector to MMX - return false; - } // Casting to something else - return false; -} - bool CastInst::isBitCastable(Type *SrcTy, Type *DestTy) { if (!SrcTy->isFirstClassType() || !DestTy->isFirstClassType()) return false; @@ -3261,7 +3203,6 @@ // castIsValid( getCastOpcode(Val, Ty), Val, Ty) // should not assert in castIsValid. In other words, this produces a "correct" // casting opcode for the arguments passed to it. -// This routine must be kept in sync with isCastable. Instruction::CastOps CastInst::getCastOpcode( const Value *Src, bool SrcIsSigned, Type *DestTy, bool DestIsSigned) { Index: llvm/unittests/IR/InstructionsTest.cpp =================================================================== --- llvm/unittests/IR/InstructionsTest.cpp +++ llvm/unittests/IR/InstructionsTest.cpp @@ -229,11 +229,6 @@ const Constant *v2ptr32 = Constant::getNullValue(V2Int32PtrTy); - EXPECT_TRUE(CastInst::isCastable(V8x8Ty, X86MMXTy)); - EXPECT_TRUE(CastInst::isCastable(X86MMXTy, V8x8Ty)); - EXPECT_FALSE(CastInst::isCastable(Int64Ty, X86MMXTy)); - EXPECT_TRUE(CastInst::isCastable(V8x64Ty, V8x8Ty)); - EXPECT_TRUE(CastInst::isCastable(V8x8Ty, V8x64Ty)); EXPECT_EQ(CastInst::Trunc, CastInst::getCastOpcode(c64, true, V8x8Ty, true)); EXPECT_EQ(CastInst::SExt, CastInst::getCastOpcode(c8, true, V8x64Ty, true)); @@ -249,7 +244,6 @@ EXPECT_FALSE(CastInst::isBitCastable(V2Int32PtrTy, V2Int32PtrAS1Ty)); EXPECT_FALSE(CastInst::isBitCastable(V2Int32PtrAS1Ty, V2Int32PtrTy)); EXPECT_TRUE(CastInst::isBitCastable(V2Int32PtrAS1Ty, V2Int64PtrAS1Ty)); - EXPECT_TRUE(CastInst::isCastable(V2Int32PtrAS1Ty, V2Int32PtrTy)); EXPECT_EQ(CastInst::AddrSpaceCast, CastInst::getCastOpcode(v2ptr32, true, V2Int32PtrAS1Ty, true));