|
1 |
| -; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4 |
2 | 1 | ; REQUIRES: asserts
|
3 | 2 | ; RUN: opt -S < %s -p loop-vectorize -enable-early-exit-vectorization -disable-output \
|
4 | 3 | ; RUN: -debug-only=loop-vectorize 2>&1 | FileCheck %s --check-prefixes=CHECK
|
@@ -87,4 +86,32 @@ loop.end:
|
87 | 86 | ret i64 %retval
|
88 | 87 | }
|
89 | 88 |
|
| 89 | +define i64 @vectorization_not_profitable_due_to_trunc(ptr dereferenceable(800) %src) { |
| 90 | +; CHECK-LABEL: LV: Checking a loop in 'vectorization_not_profitable_due_to_trunc' |
| 91 | +; CHECK: LV: Selecting VF: 1. |
| 92 | +; CHECK-NEXT: Calculating cost of work in exit block vector.early.exit: |
| 93 | +; CHECK-NEXT: LV: Vectorization is possible but not beneficial. |
| 94 | +entry: |
| 95 | + br label %loop.header |
| 96 | + |
| 97 | +loop.header: |
| 98 | + %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop.latch ] |
| 99 | + %gep.src = getelementptr inbounds i64, ptr %src, i64 %iv |
| 100 | + %l = load i64, ptr %gep.src, align 1 |
| 101 | + %t = trunc i64 %l to i1 |
| 102 | + br i1 %t, label %exit.0, label %loop.latch |
| 103 | + |
| 104 | +loop.latch: |
| 105 | + %iv.next = add i64 %iv, 1 |
| 106 | + %ec = icmp eq i64 %iv.next, 100 |
| 107 | + br i1 %ec, label %exit.1, label %loop.header |
| 108 | + |
| 109 | +exit.0: |
| 110 | + %res = phi i64 [ %l, %loop.header ] |
| 111 | + ret i64 %res |
| 112 | + |
| 113 | +exit.1: |
| 114 | + ret i64 0 |
| 115 | +} |
| 116 | + |
90 | 117 | attributes #1 = { "target-features"="+sve" vscale_range(1,16) }
|
0 commit comments