File: outer_loop_early_exit.ll

package info (click to toggle)
llvm-toolchain-20 1%3A20.1.6-1~exp1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 2,111,304 kB
  • sloc: cpp: 7,438,677; ansic: 1,393,822; asm: 1,012,926; python: 241,650; f90: 86,635; objc: 75,479; lisp: 42,144; pascal: 17,286; sh: 10,027; ml: 5,082; perl: 4,730; awk: 3,523; makefile: 3,349; javascript: 2,251; xml: 892; fortran: 672
file content (49 lines) | stat: -rw-r--r-- 1,671 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
; REQUIRES: asserts
; RUN: opt -S -passes=loop-vectorize -enable-vplan-native-path -disable-output -debug 2>&1 < %s | FileCheck %s

; CHECK-LABEL: LV: Found a loop: for.body
; CHECK: LV: Not vectorizing: Unsupported conditional branch.
; CHECK: loop not vectorized: loop control flow is not understood by vectorizer
; CHECK: LV: Not vectorizing: Unsupported outer loop.

@arr2 = external global [8 x i32], align 16
@arr = external global [8 x [8 x i32]], align 16

define i32 @foo(i32 %n) {
entry:
  br label %for.body

for.body:
  %iv.outer = phi i64 [ 0, %entry ], [%iv.outer.next, %for.inc ]
  %arrayidx = getelementptr inbounds [8 x i32], ptr @arr2, i64 0, i64 %iv.outer
  %ld1 = load i32, ptr %arrayidx, align 4
  %0 = trunc i64 %iv.outer to i32
  store i32 %0, ptr %arrayidx, align 4
  %1 = trunc i64 %iv.outer to i32
  %add = add nsw i32 %1, %n
  %cmp.early = icmp eq i32 %ld1, 3
  br i1 %cmp.early, label %for.early, label %for.body.inner

for.body.inner:
  %iv.inner = phi i64 [ 0, %for.body ], [ %iv.inner.next, %for.body.inner ]
  %arrayidx7 = getelementptr inbounds [8 x [8 x i32]], ptr @arr, i64 0, i64 %iv.inner, i64 %iv.outer
  store i32 %add, ptr %arrayidx7, align 4
  %iv.inner.next = add nuw nsw i64 %iv.inner, 1
  %cmp.inner = icmp eq i64 %iv.inner.next, 8
  br i1 %cmp.inner, label %for.inc, label %for.body.inner

for.inc:
  %iv.outer.next = add nuw nsw i64 %iv.outer, 1
  %cmp.outer = icmp eq i64%iv.outer.next, 8
  br i1 %cmp.outer, label %for.end, label %for.body, !llvm.loop !1

for.early:
  ret i32 1

for.end:
  ret i32 0
}

!1 = distinct !{!1, !2, !3}
!2 = !{!"llvm.loop.vectorize.width", i32 4}
!3 = !{!"llvm.loop.vectorize.enable", i1 true}