diff options
author | Haicheng Wu <haicheng@codeaurora.org> | 2017-12-04 19:56:33 +0000 |
---|---|---|
committer | Haicheng Wu <haicheng@codeaurora.org> | 2017-12-04 19:56:33 +0000 |
commit | 15bf0436abba4974e68ec6eceab62e2fe3b358e4 (patch) | |
tree | 831709be08efd8bf85c65f314a0ce7a4b7217e92 /test | |
parent | c965de5bf8b7c3d160a7524110dddaa5d10d85b9 (diff) |
[ConstantFold] Support vector index when factoring out GEP index into preceding dimensions
Follow-up of r316824. This patch supports the vector type for both current and
previous index when factoring out the current one into the previous one.
Differential Revision: https://reviews.llvm.org/D39556
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319683 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/Assembler/getelementptr_vec_ce.ll | 2 | ||||
-rw-r--r-- | test/Transforms/InstCombine/gep-vector.ll | 20 | ||||
-rw-r--r-- | test/Transforms/InstSimplify/vector_gep.ll | 2 |
3 files changed, 19 insertions, 5 deletions
diff --git a/test/Assembler/getelementptr_vec_ce.ll b/test/Assembler/getelementptr_vec_ce.ll index 4cf2964a57f..67029698bfc 100644 --- a/test/Assembler/getelementptr_vec_ce.ll +++ b/test/Assembler/getelementptr_vec_ce.ll @@ -3,7 +3,7 @@ @G = global [4 x i32] zeroinitializer ; CHECK-LABEL: @foo -; CHECK: ret <4 x i32*> getelementptr ([4 x i32], [4 x i32]* @G, <4 x i32> zeroinitializer, <4 x i32> <i32 0, i32 1, i32 2, i32 3>) +; CHECK: ret <4 x i32*> getelementptr inbounds ([4 x i32], [4 x i32]* @G, <4 x i32> zeroinitializer, <4 x i32> <i32 0, i32 1, i32 2, i32 3>) define <4 x i32*> @foo() { ret <4 x i32*> getelementptr ([4 x i32], [4 x i32]* @G, i32 0, <4 x i32> <i32 0, i32 1, i32 2, i32 3>) } diff --git a/test/Transforms/InstCombine/gep-vector.ll b/test/Transforms/InstCombine/gep-vector.ll index f7ed1a776f5..9f55981ae45 100644 --- a/test/Transforms/InstCombine/gep-vector.ll +++ b/test/Transforms/InstCombine/gep-vector.ll @@ -16,9 +16,23 @@ define <8 x i64*> @patatino2() { @block = global [64 x [8192 x i8]] zeroinitializer, align 1 -; CHECK-LABEL:vectorindex -; CHECK-NEXT: ret <2 x i8*> getelementptr inbounds ([64 x [8192 x i8]], [64 x [8192 x i8]]* @block, <2 x i64> zeroinitializer, <2 x i64> <i64 0, i64 1>, <2 x i64> <i64 8192, i64 8192>) -define <2 x i8*> @vectorindex() { +; CHECK-LABEL:vectorindex1 +; CHECK-NEXT: ret <2 x i8*> getelementptr inbounds ([64 x [8192 x i8]], [64 x [8192 x i8]]* @block, <2 x i64> zeroinitializer, <2 x i64> <i64 1, i64 2>, <2 x i64> zeroinitializer) +define <2 x i8*> @vectorindex1() { %1 = getelementptr inbounds [64 x [8192 x i8]], [64 x [8192 x i8]]* @block, i64 0, <2 x i64> <i64 0, i64 1>, i64 8192 ret <2 x i8*> %1 } + +; CHECK-LABEL:vectorindex2 +; CHECK-NEXT: ret <2 x i8*> getelementptr inbounds ([64 x [8192 x i8]], [64 x [8192 x i8]]* @block, <2 x i64> zeroinitializer, <2 x i64> <i64 1, i64 2>, <2 x i64> <i64 8191, i64 1>) +define <2 x i8*> @vectorindex2() { + %1 = getelementptr inbounds [64 x [8192 x i8]], [64 x [8192 x i8]]* @block, i64 0, i64 1, <2 x i64> <i64 8191, i64 8193> + ret <2 x i8*> %1 +} + +; CHECK-LABEL:vectorindex3 +; CHECK-NEXT: ret <2 x i8*> getelementptr inbounds ([64 x [8192 x i8]], [64 x [8192 x i8]]* @block, <2 x i64> zeroinitializer, <2 x i64> <i64 0, i64 2>, <2 x i64> <i64 8191, i64 1>) +define <2 x i8*> @vectorindex3() { + %1 = getelementptr inbounds [64 x [8192 x i8]], [64 x [8192 x i8]]* @block, i64 0, <2 x i64> <i64 0, i64 1>, <2 x i64> <i64 8191, i64 8193> + ret <2 x i8*> %1 +} diff --git a/test/Transforms/InstSimplify/vector_gep.ll b/test/Transforms/InstSimplify/vector_gep.ll index cdf4732d4b5..25f2255a2a7 100644 --- a/test/Transforms/InstSimplify/vector_gep.ll +++ b/test/Transforms/InstSimplify/vector_gep.ll @@ -58,7 +58,7 @@ define <4 x i8*> @test5() { define <16 x i32*> @test6() { ; CHECK-LABEL: @test6 -; CHECK-NEXT: ret <16 x i32*> getelementptr ([24 x [42 x [3 x i32]]], [24 x [42 x [3 x i32]]]* @v, <16 x i64> zeroinitializer, <16 x i64> zeroinitializer, <16 x i64> <i64 0, i64 1, i64 2, i64 3, i64 4, i64 5, i64 6, i64 7, i64 8, i64 9, i64 10, i64 11, i64 12, i64 13, i64 14, i64 15>, <16 x i64> zeroinitializer) +; CHECK-NEXT: ret <16 x i32*> getelementptr inbounds ([24 x [42 x [3 x i32]]], [24 x [42 x [3 x i32]]]* @v, <16 x i64> zeroinitializer, <16 x i64> zeroinitializer, <16 x i64> <i64 0, i64 1, i64 2, i64 3, i64 4, i64 5, i64 6, i64 7, i64 8, i64 9, i64 10, i64 11, i64 12, i64 13, i64 14, i64 15>, <16 x i64> zeroinitializer) %VectorGep = getelementptr [24 x [42 x [3 x i32]]], [24 x [42 x [3 x i32]]]* @v, i64 0, i64 0, <16 x i64> <i64 0, i64 1, i64 2, i64 3, i64 4, i64 5, i64 6, i64 7, i64 8, i64 9, i64 10, i64 11, i64 12, i64 13, i64 14, i64 15>, i64 0 ret <16 x i32*> %VectorGep } |