aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMatt Arsenault <Matthew.Arsenault@amd.com>2013-08-19 21:43:16 +0000
committerMatt Arsenault <Matthew.Arsenault@amd.com>2013-08-19 21:43:16 +0000
commitc4d070ad07c606f77af15604dbbe817edd11ca9c (patch)
treeb74faa0cafbb3849088bb1117dab579637810b00 /test
parent05bae3bfe47b63976cfa63b4756d3e768dd9eebc (diff)
downloadexternal_llvm-c4d070ad07c606f77af15604dbbe817edd11ca9c.zip
external_llvm-c4d070ad07c606f77af15604dbbe817edd11ca9c.tar.gz
external_llvm-c4d070ad07c606f77af15604dbbe817edd11ca9c.tar.bz2
Fix assert with GEP ptr vector indexing structs
Also fix it calculating the wrong value. The struct index is not a ConstantInt, so it was being interpreted as an array index. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188713 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/Transforms/InstCombine/getelementptr.ll11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/Transforms/InstCombine/getelementptr.ll b/test/Transforms/InstCombine/getelementptr.ll
index a0e3375..92be87c 100644
--- a/test/Transforms/InstCombine/getelementptr.ll
+++ b/test/Transforms/InstCombine/getelementptr.ll
@@ -129,6 +129,17 @@ define i1 @test13(i64 %X, %S* %P) {
; CHECK: %C = icmp eq i64 %X, -1
}
+define <2 x i1> @test13_vector(<2 x i64> %X, <2 x %S*> %P) nounwind {
+; CHECK-LABEL: @test13_vector(
+; CHECK-NEXT: shl nuw <2 x i64> %X, <i64 2, i64 2>
+; CHECK-NEXT: add <2 x i64> %A.idx, <i64 4, i64 4>
+; CHECK-NEXT: icmp eq <2 x i64> %A.offs, zeroinitializer
+ %A = getelementptr inbounds <2 x %S*> %P, <2 x i64> zeroinitializer, <2 x i32> <i32 1, i32 1>, <2 x i64> %X
+ %B = getelementptr inbounds <2 x %S*> %P, <2 x i64> <i64 0, i64 0>, <2 x i32> <i32 0, i32 0>
+ %C = icmp eq <2 x i32*> %A, %B
+ ret <2 x i1> %C
+}
+
define i1 @test13_i32(i32 %X, %S* %P) {
; CHECK-LABEL: @test13_i32(
; CHECK: %C = icmp eq i32 %X, -1