1 ; RUN: opt -S -instsimplify < %s | FileCheck %s 2 3 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" 4 5 declare void @helper(<2 x i8*>) 6 define void @test(<2 x i8*> %a) { 7 %A = getelementptr i8, <2 x i8*> %a, <2 x i32> <i32 0, i32 0> 8 call void @helper(<2 x i8*> %A) 9 ret void 10 } 11 12 define <4 x i8*> @test1(<4 x i8*> %a) { 13 %gep = getelementptr i8, <4 x i8*> %a, <4 x i32> zeroinitializer 14 ret <4 x i8*> %gep 15 16 ; CHECK-LABEL: @test1 17 ; CHECK-NEXT: ret <4 x i8*> %a 18 } 19 20 define <4 x i8*> @test2(<4 x i8*> %a) { 21 %gep = getelementptr i8, <4 x i8*> %a 22 ret <4 x i8*> %gep 23 24 ; CHECK-LABEL: @test2 25 ; CHECK-NEXT: ret <4 x i8*> %a 26 } 27 28 %struct = type { double, float } 29 30 define <4 x float*> @test3() { 31 %gep = getelementptr %struct, <4 x %struct*> undef, <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32> <i32 1, i32 1, i32 1, i32 1> 32 ret <4 x float*> %gep 33 34 ; CHECK-LABEL: @test3 35 ; CHECK-NEXT: ret <4 x float*> undef 36 } 37 38 %struct.empty = type { } 39 40 define <4 x %struct.empty*> @test4(<4 x %struct.empty*> %a) { 41 %gep = getelementptr %struct.empty, <4 x %struct.empty*> %a, <4 x i32> <i32 1, i32 1, i32 1, i32 1> 42 ret <4 x %struct.empty*> %gep 43 44 ; CHECK-LABEL: @test4 45 ; CHECK-NEXT: ret <4 x %struct.empty*> %a 46 } 47 48 define <4 x i8*> @test5() { 49 %c = inttoptr <4 x i64> <i64 1, i64 2, i64 3, i64 4> to <4 x i8*> 50 %gep = getelementptr i8, <4 x i8*> %c, <4 x i32> <i32 1, i32 1, i32 1, i32 1> 51 ret <4 x i8*> %gep 52 53 ; CHECK-LABEL: @test5 54 ; CHECK-NEXT: ret <4 x i8*> getelementptr (i8, <4 x i8*> <i8* inttoptr (i64 1 to i8*), i8* inttoptr (i64 2 to i8*), i8* inttoptr (i64 3 to i8*), i8* inttoptr (i64 4 to i8*)>, <4 x i32> <i32 1, i32 1, i32 1, i32 1>) 55 } 56