File: scalar_after_vectorization.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 (70 lines) | stat: -rw-r--r-- 2,730 bytes parent folder | download | duplicates (3)
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
; RUN: opt < %s -force-vector-width=4 -force-vector-interleave=2 -passes=loop-vectorize,instcombine -S | FileCheck %s
; RUN: opt < %s -force-vector-width=4 -force-vector-interleave=2 -passes=loop-vectorize -S | FileCheck %s --check-prefix=NO-IC

target datalayout = "e-m:e-i64:64-i128:128-n32:64-S128"

; CHECK-LABEL: @scalar_after_vectorization_0
;
; CHECK: vector.body:
; CHECK:   %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
; CHECK:   %offset.idx = or disjoint i64 %index, 1
; CHECK:   %[[T2:.+]] = add nuw nsw i64 %offset.idx, %tmp0
; CHECK:   %[[T3:.+]] = sub nsw i64 %[[T2]], %x
; CHECK:   %[[T4:.+]] = getelementptr inbounds i32, ptr %a, i64 %[[T3]]
; CHECK:   %[[T6:.+]] = getelementptr inbounds i8, ptr %[[T4]], i64 16
; CHECK:   load <4 x i32>, ptr %[[T4]], align 4
; CHECK:   load <4 x i32>, ptr %[[T6]], align 4
; CHECK:   br {{.*}}, label %middle.block, label %vector.body
;
; NO-IC-LABEL: @scalar_after_vectorization_0
;
; NO-IC: vector.body:
; NO-IC:   %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
; NO-IC:   %offset.idx = add i64 1, %index
; NO-IC:   %[[T2:.+]] = add i64 %offset.idx, 0
; NO-IC:   %[[T3:.+]] = add i64 %offset.idx, 4
; NO-IC:   %[[T4:.+]] = add nuw nsw i64 %[[T2]], %tmp0
; NO-IC:   %[[T5:.+]] = add nuw nsw i64 %[[T3]], %tmp0
; NO-IC:   %[[T6:.+]] = sub nsw i64 %[[T4]], %x
; NO-IC:   %[[T7:.+]] = sub nsw i64 %[[T5]], %x
; NO-IC:   %[[T8:.+]] = getelementptr inbounds i32, ptr %a, i64 %[[T6]]
; NO-IC:   %[[T9:.+]] = getelementptr inbounds i32, ptr %a, i64 %[[T7]]
; NO-IC:   %[[T10:.+]] = getelementptr inbounds i32, ptr %[[T8]], i32 0
; NO-IC:   %[[T12:.+]] = getelementptr inbounds i32, ptr %[[T8]], i32 4
; NO-IC:   load <4 x i32>, ptr %[[T10]], align 4
; NO-IC:   load <4 x i32>, ptr %[[T12]], align 4
; NO-IC:   br {{.*}}, label %middle.block, label %vector.body
;
define void @scalar_after_vectorization_0(ptr noalias %a, ptr noalias %b, i64 %x, i64 %y) {

outer.ph:
  br label %outer.body

outer.body:
  %i = phi i64 [ 1, %outer.ph ], [ %i.next, %inner.end ]
  %tmp0 = mul nuw nsw i64 %i, %x
  br label %inner.ph

inner.ph:
  br label %inner.body

inner.body:
  %j = phi i64 [ 1, %inner.ph ], [ %j.next, %inner.body ]
  %tmp1 = add nuw nsw i64 %j, %tmp0
  %tmp2 = sub nsw i64 %tmp1, %x
  %tmp3 = getelementptr inbounds i32, ptr %a, i64 %tmp2
  %tmp4 = load i32, ptr %tmp3, align 4
  %tmp5 = getelementptr inbounds i32, ptr %b, i64 %tmp1
  store i32 %tmp4, ptr %tmp5, align 4
  %j.next = add i64 %j, 1
  %cond.j = icmp slt i64 %j.next, %y
  br i1 %cond.j, label %inner.body, label %inner.end

inner.end:
  %i.next = add i64 %i, 1
  %cond.i = icmp slt i64 %i.next, %y
  br i1 %cond.i, label %outer.body, label %outer.end

outer.end:
  ret void
}