summaryrefslogtreecommitdiff
path: root/test/Transforms
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2013-06-01 20:51:31 +0000
committerNick Lewycky <nicholas@mxc.ca>2013-06-01 20:51:31 +0000
commite4546cb71e14baa0cde8f85a12cfa8b2d44fe708 (patch)
tree16c65db3f1487fe99a4fb6f91ad8b4880e231fec /test/Transforms
parenta0b34d6c4ab05d0c04905e2aff0c9e6b879908ff (diff)
downloadllvm-e4546cb71e14baa0cde8f85a12cfa8b2d44fe708.tar.gz
llvm-e4546cb71e14baa0cde8f85a12cfa8b2d44fe708.tar.bz2
llvm-e4546cb71e14baa0cde8f85a12cfa8b2d44fe708.tar.xz
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183080 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms')
-rw-r--r--test/Transforms/InstCombine/vec_shuffle.ll11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/Transforms/InstCombine/vec_shuffle.ll b/test/Transforms/InstCombine/vec_shuffle.ll
index 4b7a049bae..5ffe6c0437 100644
--- a/test/Transforms/InstCombine/vec_shuffle.ll
+++ b/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
+}