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 | 234eabaf07d678586c945938963fa896a135f4da (patch) | |
| tree | 66b190dd28889a99a76811875889069d76c81768 /llvm/test/Transforms/InstCombine/gep-vector.ll | |
| parent | dc81fd6cec5a8a877ee15174ac5fa2479dc4a932 (diff) | |
| download | bcm5719-llvm-234eabaf07d678586c945938963fa896a135f4da.tar.gz bcm5719-llvm-234eabaf07d678586c945938963fa896a135f4da.zip | |
[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
llvm-svn: 319683
Diffstat (limited to 'llvm/test/Transforms/InstCombine/gep-vector.ll')
| -rw-r--r-- | llvm/test/Transforms/InstCombine/gep-vector.ll | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/llvm/test/Transforms/InstCombine/gep-vector.ll b/llvm/test/Transforms/InstCombine/gep-vector.ll index f7ed1a776f5..9f55981ae45 100644 --- a/llvm/test/Transforms/InstCombine/gep-vector.ll +++ b/llvm/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 +} |

