Bug 18228 - Fix accepting bitcasts between vectors of pointers with a
authorMatt Arsenault <Matthew.Arsenault@amd.com>
Wed, 22 Jan 2014 19:21:33 +0000 (19:21 +0000)
committerMatt Arsenault <Matthew.Arsenault@amd.com>
Wed, 22 Jan 2014 19:21:33 +0000 (19:21 +0000)
commit79e3fb53d618d12e239275ef055200bbd6f8253e
treeb4c47cd1fa8d59c138096c71bf9d1509f2b73d85
parent148c7f286c0929962e33019ac4c15c103dd79b76
Bug 18228 - Fix accepting bitcasts between vectors of pointers with a
different number of elements.

Bitcasts were passing with vectors of pointers with different number of
elements since the number of elements was checking
SrcTy->getVectorNumElements() == SrcTy->getVectorNumElements() which
isn't helpful. The addrspacecast was also wrong, but that case at least
is caught by the verifier. Refactor bitcast and addrspacecast handling
in castIsValid to be more readable and fix this problem.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199821 91177308-0d34-0410-b5e6-96231b3b80d8
lib/IR/Instructions.cpp
test/Assembler/invalid_cast3.ll [new file with mode: 0644]
unittests/IR/InstructionsTest.cpp