|
| 1 | +; REQUIRES: asserts |
| 2 | +; RUN: opt -S -passes=loop-vectorize -enable-vplan-native-path -disable-output -debug 2>&1 < %s | FileCheck %s |
| 3 | + |
| 4 | +; CHECK-LABEL: LV: Found a loop: for.body |
| 5 | +; CHECK: LV: Not vectorizing: Unsupported conditional branch. |
| 6 | +; CHECK: loop not vectorized: loop control flow is not understood by vectorizer |
| 7 | +; CHECK: LV: Not vectorizing: Unsupported outer loop. |
| 8 | + |
| 9 | +@arr2 = external global [8 x i32], align 16 |
| 10 | +@arr = external global [8 x [8 x i32]], align 16 |
| 11 | + |
| 12 | +define i32 @foo(i32 %n) { |
| 13 | +entry: |
| 14 | + br label %for.body |
| 15 | + |
| 16 | +for.body: |
| 17 | + %iv.outer = phi i64 [ 0, %entry ], [%iv.outer.next, %for.inc ] |
| 18 | + %arrayidx = getelementptr inbounds [8 x i32], ptr @arr2, i64 0, i64 %iv.outer |
| 19 | + %ld1 = load i32, ptr %arrayidx, align 4 |
| 20 | + %0 = trunc i64 %iv.outer to i32 |
| 21 | + store i32 %0, ptr %arrayidx, align 4 |
| 22 | + %1 = trunc i64 %iv.outer to i32 |
| 23 | + %add = add nsw i32 %1, %n |
| 24 | + %cmp.early = icmp eq i32 %ld1, 3 |
| 25 | + br i1 %cmp.early, label %for.early, label %for.body.inner |
| 26 | + |
| 27 | +for.body.inner: |
| 28 | + %iv.inner = phi i64 [ 0, %for.body ], [ %iv.inner.next, %for.body.inner ] |
| 29 | + %arrayidx7 = getelementptr inbounds [8 x [8 x i32]], ptr @arr, i64 0, i64 %iv.inner, i64 %iv.outer |
| 30 | + store i32 %add, ptr %arrayidx7, align 4 |
| 31 | + %iv.inner.next = add nuw nsw i64 %iv.inner, 1 |
| 32 | + %cmp.inner = icmp eq i64 %iv.inner.next, 8 |
| 33 | + br i1 %cmp.inner, label %for.inc, label %for.body.inner |
| 34 | + |
| 35 | +for.inc: |
| 36 | + %iv.outer.next = add nuw nsw i64 %iv.outer, 1 |
| 37 | + %cmp.outer = icmp eq i64%iv.outer.next, 8 |
| 38 | + br i1 %cmp.outer, label %for.end, label %for.body, !llvm.loop !1 |
| 39 | + |
| 40 | +for.early: |
| 41 | + ret i32 1 |
| 42 | + |
| 43 | +for.end: |
| 44 | + ret i32 0 |
| 45 | +} |
| 46 | + |
| 47 | +!1 = distinct !{!1, !2, !3} |
| 48 | +!2 = !{!"llvm.loop.vectorize.width", i32 4} |
| 49 | +!3 = !{!"llvm.loop.vectorize.enable", i1 true} |
0 commit comments