File: redundant-vf2-cost.ll

package info (click to toggle)
llvm-toolchain-19 1%3A19.1.7-3~deb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm-proposed-updates
  • size: 1,998,492 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 (34 lines) | stat: -rw-r--r-- 1,326 bytes parent folder | download | duplicates (8)
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
; RUN: opt < %s -passes=loop-vectorize -mtriple x86_64 -debug -disable-output 2>&1 | FileCheck %s
; REQUIRES: asserts

; Check that cost model is not executed twice for VF=2 when vectorization is
; forced for a particular loop.

; CHECK: LV: Found an estimated cost of {{[0-9]+}} for VF 2 For instruction:   %{{[0-9]+}} = load i32
; CHECK: LV: Found an estimated cost of {{[0-9]+}} for VF 2 For instruction:   store i32
; CHECK-NOT: LV: Found an estimated cost of {{[0-9]+}} for VF 2 For instruction:   %{{[0-9]+}} = load i32
; CHECK-NOT: LV: Found an estimated cost of {{[0-9]+}} for VF 2 For instruction:   store i32
; CHECK: LV: Vector loop of width 2 costs: {{[0-9]+}}.

define i32 @foo(ptr %A, i32 %n) {
entry:
  %cmp3.i = icmp eq i32 %n, 0
  br i1 %cmp3.i, label %exit, label %for.body.i

for.body.i:
  %iv = phi i32 [ %add.i, %for.body.i ], [ 0, %entry ]
  %ld_addr = getelementptr inbounds i32, ptr %A, i32 %iv
  %0 = load i32, ptr %ld_addr, align 4
  %val = add i32 %0, 1
  store i32 %val, ptr %ld_addr, align 4
  %add.i = add nsw i32 %iv, 1
  %cmp.i = icmp eq i32 %add.i, %n
  br i1 %cmp.i, label %exit, label %for.body.i, !llvm.loop !0

exit:
  %__init.addr.0.lcssa.i = phi i32 [ 0, %entry ], [ %add.i, %for.body.i ]
  ret i32 %__init.addr.0.lcssa.i
}

!0 = !{!0, !1}
!1 = !{!"llvm.loop.vectorize.enable", i1 true}