File: vector_gep.ll

package info (click to toggle)
llvm-toolchain-3.8 1%3A3.8.1-24
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 379,280 kB
  • ctags: 388,501
  • sloc: cpp: 2,309,705; ansic: 477,070; objc: 100,918; asm: 97,974; python: 95,911; sh: 18,634; makefile: 7,294; perl: 5,584; ml: 5,460; pascal: 4,661; lisp: 2,548; xml: 686; cs: 350; php: 212; csh: 117
file content (55 lines) | stat: -rw-r--r-- 1,643 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
; RUN: opt -S -instsimplify < %s | FileCheck %s

target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"

declare void @helper(<2 x i8*>)
define void @test(<2 x i8*> %a) {
  %A = getelementptr i8, <2 x i8*> %a, <2 x i32> <i32 0, i32 0>
  call void @helper(<2 x i8*> %A)
  ret void
}

define <4 x i8*> @test1(<4 x i8*> %a) {
  %gep = getelementptr i8, <4 x i8*> %a, <4 x i32> zeroinitializer
  ret <4 x i8*> %gep

; CHECK-LABEL: @test1
; CHECK-NEXT: ret <4 x i8*> %a
}

define <4 x i8*> @test2(<4 x i8*> %a) {
  %gep = getelementptr i8, <4 x i8*> %a
  ret <4 x i8*> %gep

; CHECK-LABEL: @test2
; CHECK-NEXT: ret <4 x i8*> %a
}

%struct = type { double, float }

define <4 x float*> @test3() {
  %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>
  ret <4 x float*> %gep

; CHECK-LABEL: @test3
; CHECK-NEXT: ret <4 x float*> undef
}

%struct.empty = type { }

define <4 x %struct.empty*> @test4(<4 x %struct.empty*> %a) {
  %gep = getelementptr %struct.empty, <4 x %struct.empty*> %a, <4 x i32> <i32 1, i32 1, i32 1, i32 1>
  ret <4 x %struct.empty*> %gep

; CHECK-LABEL: @test4
; CHECK-NEXT: ret <4 x %struct.empty*> %a
}

define <4 x i8*> @test5() {
  %c = inttoptr <4 x i64> <i64 1, i64 2, i64 3, i64 4> to <4 x i8*>
  %gep = getelementptr i8, <4 x i8*> %c, <4 x i32> <i32 1, i32 1, i32 1, i32 1>
  ret <4 x i8*> %gep

; CHECK-LABEL: @test5
; 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>)
}