File: opt-pipeline-vector-passes.ll

package info (click to toggle)
llvm-toolchain-19 1%3A19.1.7-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,998,520 kB
  • sloc: cpp: 6,951,680; ansic: 1,486,157; asm: 913,598; python: 232,024; f90: 80,126; objc: 75,281; lisp: 37,276; pascal: 16,990; sh: 10,009; ml: 5,058; perl: 4,724; awk: 3,523; makefile: 3,167; javascript: 2,504; xml: 892; fortran: 664; cs: 573
file content (57 lines) | stat: -rw-r--r-- 2,279 bytes parent folder | download | duplicates (12)
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
; RUN: opt -disable-verify -debug-pass-manager -passes='default<O1>' -force-vector-width=4 -S %s 2>&1 | FileCheck %s --check-prefixes=O1
; RUN: opt -disable-verify -debug-pass-manager -passes='default<O2>' -force-vector-width=4 -S %s 2>&1 | FileCheck %s --check-prefixes=O2
; RUN: opt -disable-verify -debug-pass-manager -passes='default<O2>' -force-vector-width=4 -extra-vectorizer-passes -S %s 2>&1 | FileCheck %s --check-prefixes=O2_EXTRA

; When the loop doesn't get vectorized, no extra vector passes should run.
; RUN: opt -disable-verify -debug-pass-manager -passes='default<O2>' -force-vector-width=0 -extra-vectorizer-passes -S %s 2>&1 | FileCheck %s --check-prefixes=O2

; REQUIRES: asserts

; The loop vectorizer still runs at both -O1/-O2 even with the
; debug flag, but it only works on loops explicitly annotated
; with pragmas.

; SLP does not run at -O1. Loop vectorization runs, but it only
; works on loops explicitly annotated with pragmas.
; O1-LABEL:  Running pass: LoopVectorizePass
; O1-NOT:    Running pass: SLPVectorizerPass
; O1:        Running pass: VectorCombinePass

; Everything runs at -O2.
; O2-LABEL:  Running pass: LoopVectorizePass
; O2-NOT:    Running pass: EarlyCSEPass
; O2-NOT:    Running pass: LICMPass
; O2:        Running pass: SLPVectorizerPass
; O2:        Running pass: VectorCombinePass

; Optionally run cleanup passes.
; O2_EXTRA-LABEL: Running pass: LoopVectorizePass
; O2_EXTRA: Running pass: EarlyCSEPass
; O2_EXTRA: Running pass: CorrelatedValuePropagationPass
; O2_EXTRA: Running pass: InstCombinePass
; O2_EXTRA: Running pass: LICMPass
; O2_EXTRA: Running pass: SimpleLoopUnswitchPass
; O2_EXTRA: Running pass: SimplifyCFGPass
; O2_EXTRA: Running pass: InstCombinePass
; O2_EXTRA: Running pass: SLPVectorizerPass
; O2_EXTRA: Running pass: EarlyCSEPass
; O2_EXTRA: Running pass: VectorCombinePass

define i64 @f(i1 %cond, ptr %src, ptr %dst) {
entry:
  br label %loop

loop:
  %i = phi i64 [ 0, %entry ], [ %inc, %loop ]
  %src.i = getelementptr i32, ptr %src, i64 %i
  %src.v = load i32, ptr %src.i
  %add = add i32 %src.v, 10
  %dst.i = getelementptr i32, ptr %dst, i64 %i
  store i32 %add, ptr %dst.i
  %inc = add nuw nsw i64 %i, 1
  %ec = icmp ne i64 %inc, 1000
  br i1 %ec, label %loop, label %exit

exit:
  ret i64 %i
}