File: getpointerschaincost.ll

package info (click to toggle)
llvm-toolchain-17 1%3A17.0.6-22
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,799,624 kB
  • sloc: cpp: 6,428,607; ansic: 1,383,196; asm: 793,408; python: 223,504; objc: 75,364; f90: 60,502; lisp: 33,869; pascal: 15,282; sh: 9,684; perl: 7,453; ml: 4,937; awk: 3,523; makefile: 2,889; javascript: 2,149; xml: 888; fortran: 619; cs: 573
file content (101 lines) | stat: -rw-r--r-- 3,988 bytes parent folder | download | duplicates (6)
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 2
; RUN: opt -S -mtriple=riscv64 -mattr=+v -riscv-v-slp-max-vf=0 -passes=slp-vectorizer -pass-remarks-output=%t < %s | FileCheck %s
; RUN: FileCheck --input-file=%t --check-prefix=YAML %s

; Because all of these addresses are foldable, the scalar cost should be 0 when
; computing the pointers chain cost.
;
; TODO: These are currently costed as free the indices are all constants, but we
; should check if the constants are actually foldable
define void @f(ptr %dest, i64 %i) {
; CHECK-LABEL: define void @f
; CHECK-SAME: (ptr [[DEST:%.*]], i64 [[I:%.*]]) #[[ATTR0:[0-9]+]] {
; CHECK-NEXT:  entry:
; CHECK-NEXT:    [[P1:%.*]] = getelementptr i32, ptr [[DEST]], i32 0
; CHECK-NEXT:    store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr [[P1]], align 4
; CHECK-NEXT:    ret void
;
entry:
; YAML:      Pass:            slp-vectorizer
; YAML-NEXT: Name:            StoresVectorized
; YAML-NEXT: Function:        f
; YAML-NEXT: Args:
; YAML-NEXT:   - String:          'Stores SLP vectorized with cost '
; YAML-NEXT:   - Cost:            '-2'
; YAML-NEXT:   - String:          ' and with tree size '
; YAML-NEXT:   - TreeSize:        '2'
  %p1 = getelementptr i32, ptr %dest, i32 0
  store i32 1, ptr %p1
  %p2 = getelementptr i32, ptr %dest, i32 1
  store i32 1, ptr %p2
  %p3 = getelementptr i32, ptr %dest, i32 2
  store i32 1, ptr %p3
  %p4 = getelementptr i32, ptr %dest, i32 3
  store i32 1, ptr %p4
  ret void
}

; When computing the scalar pointers chain cost here, there is a cost of 1 for
; the base pointer, and the rest can be folded in, so the scalar cost should be
; 1.
;
; TODO: These are currently costed as free the indices are all constants, but we
; should check if the constants are actually foldable
define void @g(ptr %dest, i64 %i) {
; CHECK-LABEL: define void @g
; CHECK-SAME: (ptr [[DEST:%.*]], i64 [[I:%.*]]) #[[ATTR0]] {
; CHECK-NEXT:  entry:
; CHECK-NEXT:    [[P1:%.*]] = getelementptr i32, ptr [[DEST]], i32 2048
; CHECK-NEXT:    store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr [[P1]], align 4
; CHECK-NEXT:    ret void
;
entry:
; YAML:      Pass:            slp-vectorizer
; YAML-NEXT: Name:            StoresVectorized
; YAML-NEXT: Function:        g
; YAML-NEXT: Args:
; YAML-NEXT:   - String:          'Stores SLP vectorized with cost '
; YAML-NEXT:   - Cost:            '-2'
; YAML-NEXT:   - String:          ' and with tree size '
; YAML-NEXT:   - TreeSize:        '2'
  %p1 = getelementptr i32, ptr %dest, i32 2048
  store i32 1, ptr %p1
  %p2 = getelementptr i32, ptr %dest, i32 2049
  store i32 1, ptr %p2
  %p3 = getelementptr i32, ptr %dest, i32 2050
  store i32 1, ptr %p3
  %p4 = getelementptr i32, ptr %dest, i32 2051
  store i32 1, ptr %p4
  ret void
}

; When computing the scalar pointers chain cost here, there is a cost of
; 1 for the base pointer, and the rest can be folded in, so the scalar cost
; should be 1.
define void @h(ptr %dest, i32 %i) {
; CHECK-LABEL: define void @h
; CHECK-SAME: (ptr [[DEST:%.*]], i32 [[I:%.*]]) #[[ATTR0]] {
; CHECK-NEXT:  entry:
; CHECK-NEXT:    [[P1:%.*]] = getelementptr [4 x i32], ptr [[DEST]], i32 [[I]], i32 0
; CHECK-NEXT:    store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr [[P1]], align 4
; CHECK-NEXT:    ret void
;
entry:
; YAML:      Pass:            slp-vectorizer
; YAML-NEXT: Name:            StoresVectorized
; YAML-NEXT: Function:        h
; YAML-NEXT: Args:
; YAML-NEXT:   - String:          'Stores SLP vectorized with cost '
; YAML-NEXT:   - Cost:            '-2'
; YAML-NEXT:   - String:          ' and with tree size '
; YAML-NEXT:   - TreeSize:        '2'
  %p1 = getelementptr [4 x i32], ptr %dest, i32 %i, i32 0
  store i32 1, ptr %p1
  %p2 = getelementptr [4 x i32], ptr %dest, i32 %i, i32 1
  store i32 1, ptr %p2
  %p3 = getelementptr [4 x i32], ptr %dest, i32 %i, i32 2
  store i32 1, ptr %p3
  %p4 = getelementptr [4 x i32], ptr %dest, i32 %i, i32 3
  store i32 1, ptr %p4
  ret void
}