diff options
author | Duncan Sands <baldrick@free.fr> | 2011-05-18 09:21:57 +0000 |
---|---|---|
committer | Duncan Sands <baldrick@free.fr> | 2011-05-18 09:21:57 +0000 |
commit | bb1695e3332a8a47200397158a55d10d2f52946b (patch) | |
tree | 63aee20b29943645b922c22bdfb7c1103af61642 /test/Assembler/invalid_cast.ll | |
parent | 117feba971a020653fef3d6d61a16345355b83fd (diff) |
Tighten up checking of the validity of casts. (1) The IR parser would
happily accept things like "sext <2 x i32> to <999 x i64>". It would
also accept "sext <2 x i32> to i64", though the verifier would catch
that later. Fixed by having castIsValid check that vector lengths match
except when doing a bitcast. (2) When creating a cast instruction, check
that the cast is valid (this was already done when creating constexpr
casts). While there, replace getScalarSizeInBits (used to allow more
vector casts) with getPrimitiveSizeInBits in getCastOpcode and isCastable
since vector to vector casts are now handled explicitly by passing to the
element types; i.e. this bit should result in no functional change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131532 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Assembler/invalid_cast.ll')
-rw-r--r-- | test/Assembler/invalid_cast.ll | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/test/Assembler/invalid_cast.ll b/test/Assembler/invalid_cast.ll new file mode 100644 index 00000000000..c5b082b6b8d --- /dev/null +++ b/test/Assembler/invalid_cast.ll @@ -0,0 +1,6 @@ +; RUN: not llvm-as < %s |& grep {invalid cast opcode} + +define <3 x i8> @foo(<4 x i64> %x) { + %y = trunc <4 x i64> %x to <3 x i8> + ret <3 x i8> %y +} |