diff options
author | Matt Arsenault <Matthew.Arsenault@amd.com> | 2013-07-31 00:17:33 +0000 |
---|---|---|
committer | Matt Arsenault <Matthew.Arsenault@amd.com> | 2013-07-31 00:17:33 +0000 |
commit | 1bf0ec4e1642a532c0121de8ccc0878d6403c9d3 (patch) | |
tree | 4e88f3228fce8e73c2c6e0f62041b7b2c924189a /unittests/IR | |
parent | 9ce8b2818d0c143fd58f4772d2002a15653079dd (diff) | |
download | llvm-1bf0ec4e1642a532c0121de8ccc0878d6403c9d3.tar.gz llvm-1bf0ec4e1642a532c0121de8ccc0878d6403c9d3.tar.bz2 llvm-1bf0ec4e1642a532c0121de8ccc0878d6403c9d3.tar.xz |
Fix ptr vector inconsistency in CreatePointerCast
One form would accept a vector of pointers, and the other did not.
Make both accept vectors of pointers, and add an assertion
for the number of elements.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187464 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/IR')
-rw-r--r-- | unittests/IR/InstructionsTest.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/unittests/IR/InstructionsTest.cpp b/unittests/IR/InstructionsTest.cpp index c2fdceb7eb..ce6c465163 100644 --- a/unittests/IR/InstructionsTest.cpp +++ b/unittests/IR/InstructionsTest.cpp @@ -197,6 +197,17 @@ TEST(InstructionsTest, CastInst) { EXPECT_TRUE(CastInst::isBitCastable(V2Int32PtrTy, V2Int64PtrTy)); EXPECT_FALSE(CastInst::isBitCastable(V2Int32Ty, V2Int64Ty)); EXPECT_FALSE(CastInst::isBitCastable(V2Int64Ty, V2Int32Ty)); + + + // Check that assertion is not hit when creating a cast with a vector of + // pointers + // First form + BasicBlock *BB = BasicBlock::Create(C); + Constant *NullV2I32Ptr = Constant::getNullValue(V2Int32PtrTy); + CastInst::CreatePointerCast(NullV2I32Ptr, V2Int32Ty, "foo", BB); + + // Second form + CastInst::CreatePointerCast(NullV2I32Ptr, V2Int32Ty); } TEST(InstructionsTest, VectorGep) { |