File: induction-ptrcasts.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 (52 lines) | stat: -rw-r--r-- 2,522 bytes parent folder | download | duplicates (10)
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
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -passes=loop-vectorize -force-vector-width=1 -force-vector-interleave=2 -S %s | FileCheck --check-prefix=VF1 %s
; RUN: opt -passes=loop-vectorize -force-vector-width=2 -force-vector-interleave=1 -S %s | FileCheck --check-prefix=VF2 %s

@f = external dso_local global i32, align 4

define void @int_iv_based_on_pointer_iv(ptr %A) {
; VF1-LABEL: @int_iv_based_on_pointer_iv(
; VF1:       vector.body:
; VF1-NEXT:    [[INDEX:%.*]] = phi i64 [ 0, %vector.ph ], [ [[INDEX_NEXT:%.*]], %vector.body ]
; VF1-NEXT:    [[OFFSET_IDX:%.*]] = mul i64 [[INDEX]], 4
; VF1-NEXT:    [[INDUCTION:%.*]] = add i64 [[OFFSET_IDX]], 0
; VF1-NEXT:    [[INDUCTION3:%.*]] = add i64 [[OFFSET_IDX]], 4
; VF1-NEXT:    [[TMP7:%.*]] = getelementptr inbounds i8, ptr [[A:%.*]], i64 [[INDUCTION]]
; VF1-NEXT:    [[TMP8:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 [[INDUCTION3]]
; VF1-NEXT:    store i8 0, ptr [[TMP7]], align 1
; VF1-NEXT:    store i8 0, ptr [[TMP8]], align 1
; VF1-NEXT:    [[INDEX_NEXT]] = add nuw i64 [[INDEX]], 2
; VF1-NEXT:    [[TMP13:%.*]] = icmp eq i64 [[INDEX_NEXT]],
; VF1-NEXT:    br i1 [[TMP13]], label %middle.block, label %vector.body
;
; VF2-LABEL: @int_iv_based_on_pointer_iv(
; VF2:       vector.body:
; VF2-NEXT:    [[INDEX:%.*]] = phi i64 [ 0, %vector.ph ], [ [[INDEX_NEXT:%.*]], %vector.body ]
; VF2-NEXT:    [[OFFSET_IDX:%.*]] = mul i64 [[INDEX]], 4
; VF2-NEXT:    [[TMP3:%.*]] = add i64 [[OFFSET_IDX]], 0
; VF2-NEXT:    [[TMP4:%.*]] = add i64 [[OFFSET_IDX]], 4
; VF2-NEXT:    [[TMP9:%.*]] = getelementptr inbounds i8, ptr [[A:%.*]], i64 [[TMP3]]
; VF2-NEXT:    [[TMP10:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 [[TMP4]]
; VF2-NEXT:    store i8 0, ptr [[TMP9]], align 1
; VF2-NEXT:    store i8 0, ptr [[TMP10]], align 1
; VF2-NEXT:    [[INDEX_NEXT]] = add nuw i64 [[INDEX]], 2
; VF2-NEXT:    [[TMP14:%.*]] = icmp eq i64 [[INDEX_NEXT]],
; VF2-NEXT:    br i1 [[TMP14]], label %middle.block, label %vector.body
;
entry:
  br label %loop

loop:
  %iv.int = phi i64 [ 0, %entry ], [ %iv.int.next, %loop ]
  %iv.ptr = phi ptr [ null, %entry ], [ %iv.ptr.next, %loop ]
  %iv.ptr.next = getelementptr inbounds i32, ptr %iv.ptr, i64 1
  %gep.A = getelementptr inbounds i8, ptr %A, i64 %iv.int
  store i8 0, ptr %gep.A
  %iv.int.next = ptrtoint ptr %iv.ptr.next to i64
  %sub.ptr.sub = sub i64 ptrtoint (ptr @f to i64), %iv.int.next
  %cmp = icmp sgt i64 %sub.ptr.sub, 0
  br i1 %cmp, label %loop, label %exit

exit:
  ret void
}