diff options
author | Chris Lattner <sabre@nondot.org> | 2012-01-25 01:32:59 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2012-01-25 01:32:59 +0000 |
commit | 8a3df5495abfcaba4312fd740853ff80914b000a (patch) | |
tree | 2849e177396c463aee14f85576b120fa6b4aa52d /llvm/lib/VMCore/Instructions.cpp | |
parent | 9be59599b3b17be04d92a86b4bc11631e554a0d5 (diff) | |
download | bcm5719-llvm-8a3df5495abfcaba4312fd740853ff80914b000a.tar.gz bcm5719-llvm-8a3df5495abfcaba4312fd740853ff80914b000a.zip |
Remove the Type::getNumElements() method, which is only called in 4 places,
did something extremely surprising, and shadowed actually useful
implementations that had completely different behavior.
llvm-svn: 148898
Diffstat (limited to 'llvm/lib/VMCore/Instructions.cpp')
-rw-r--r-- | llvm/lib/VMCore/Instructions.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/llvm/lib/VMCore/Instructions.cpp b/llvm/lib/VMCore/Instructions.cpp index 8c375c2af3f..2c6987485ff 100644 --- a/llvm/lib/VMCore/Instructions.cpp +++ b/llvm/lib/VMCore/Instructions.cpp @@ -2671,13 +2671,19 @@ CastInst::castIsValid(Instruction::CastOps op, Value *S, Type *DstTy) { return SrcTy->isFPOrFPVectorTy() && DstTy->isIntOrIntVectorTy() && SrcLength == DstLength; case Instruction::PtrToInt: - if (SrcTy->getNumElements() != DstTy->getNumElements()) + if (isa<VectorType>(SrcTy) != isa<VectorType>(DstTy)) return false; + if (VectorType *VT = dyn_cast<VectorType>(SrcTy)) + if (VT->getNumElements() != cast<VectorType>(DstTy)->getNumElements()) + return false; return SrcTy->getScalarType()->isPointerTy() && DstTy->getScalarType()->isIntegerTy(); case Instruction::IntToPtr: - if (SrcTy->getNumElements() != DstTy->getNumElements()) + if (isa<VectorType>(SrcTy) != isa<VectorType>(DstTy)) return false; + if (VectorType *VT = dyn_cast<VectorType>(SrcTy)) + if (VT->getNumElements() != cast<VectorType>(DstTy)->getNumElements()) + return false; return SrcTy->getScalarType()->isIntegerTy() && DstTy->getScalarType()->isPointerTy(); case Instruction::BitCast: |