diff options
author | Nick Lewycky <nicholas@mxc.ca> | 2013-06-01 20:51:31 +0000 |
---|---|---|
committer | Nick Lewycky <nicholas@mxc.ca> | 2013-06-01 20:51:31 +0000 |
commit | 3f715e260a372e32fe4635d7510eaee11d53129d (patch) | |
tree | a50e9fafe342004e48af1abf4505049c9f0dcd45 /llvm/test/Transforms/InstCombine | |
parent | 28e2cd0e7e2afeefed417bf9b33cf0d8552f15f5 (diff) | |
download | bcm5719-llvm-3f715e260a372e32fe4635d7510eaee11d53129d.tar.gz bcm5719-llvm-3f715e260a372e32fe4635d7510eaee11d53129d.zip |
When determining the new index for an insertelement, we may not assume that an
index greater than the size of the vector is invalid. The shuffle may be
shrinking the size of the vector. Fixes a crash!
Also drop the maximum recursion depth of the safety check for this
optimization to five.
llvm-svn: 183080
Diffstat (limited to 'llvm/test/Transforms/InstCombine')
-rw-r--r-- | llvm/test/Transforms/InstCombine/vec_shuffle.ll | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/vec_shuffle.ll b/llvm/test/Transforms/InstCombine/vec_shuffle.ll index 4b7a049baec..5ffe6c04372 100644 --- a/llvm/test/Transforms/InstCombine/vec_shuffle.ll +++ b/llvm/test/Transforms/InstCombine/vec_shuffle.ll @@ -174,3 +174,14 @@ define <2 x i8> @test13b(i8 %x) { %B = shufflevector <2 x i8> %A, <2 x i8> undef, <2 x i32> <i32 undef, i32 0> ret <2 x i8> %B } + +define <2 x i8> @test13c(i8 %x1, i8 %x2) { +; CHECK: @test13c +; CHECK-NEXT: insertelement <2 x i8> {{.*}}, i32 0 +; CHECK-NEXT: insertelement <2 x i8> {{.*}}, i32 1 +; CHECK-NEXT: ret + %A = insertelement <4 x i8> undef, i8 %x1, i32 0 + %B = insertelement <4 x i8> %A, i8 %x2, i32 2 + %C = shufflevector <4 x i8> %B, <4 x i8> undef, <2 x i32> <i32 0, i32 2> + ret <2 x i8> %C +} |