summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/LoopVectorize
diff options
context:
space:
mode:
authorFlorian Hahn <flo@fhahn.com>2018-12-18 22:25:11 +0000
committerFlorian Hahn <flo@fhahn.com>2018-12-18 22:25:11 +0000
commit485f2826baa5e91fe9501452d0041b8398800bcd (patch)
tree69a83f85bd30e3e60fb98094b7fe31ada206f034 /llvm/test/Transforms/LoopVectorize
parent4e4920694cae642b6eea869d1f7475c61741ec44 (diff)
downloadbcm5719-llvm-485f2826baa5e91fe9501452d0041b8398800bcd.tar.gz
bcm5719-llvm-485f2826baa5e91fe9501452d0041b8398800bcd.zip
[LAA] Introduce enum for vectorization safety status (NFC).
This patch adds a VectorizationSafetyStatus enum, which will be extended in a follow up patch to distinguish between 'safe with runtime checks' and 'known unsafe' dependences. Reviewers: anemet, anna, Ayal, hsaito Reviewed By: Ayal Differential Revision: https://reviews.llvm.org/D54892 llvm-svn: 349556
Diffstat (limited to 'llvm/test/Transforms/LoopVectorize')
-rw-r--r--llvm/test/Transforms/LoopVectorize/runtime-check.ll40
1 files changed, 40 insertions, 0 deletions
diff --git a/llvm/test/Transforms/LoopVectorize/runtime-check.ll b/llvm/test/Transforms/LoopVectorize/runtime-check.ll
index 88489faa831..19bfa50f769 100644
--- a/llvm/test/Transforms/LoopVectorize/runtime-check.ll
+++ b/llvm/test/Transforms/LoopVectorize/runtime-check.ll
@@ -117,6 +117,46 @@ loopexit:
ret void
}
+; Check we do generate unnecessary runtime checks. They will always fail.
+
+; void test_runtime_check2(float *a, float b, unsigned offset, unsigned offset2, unsigned n, float *c) {
+; for (unsigned i = 1; i < n; i++) {
+; a[i+o1] += a[i+o2] + b;
+; c[i] = c[i-1] + b;
+; }
+; }
+;
+; CHECK-LABEL: test_runtime_check2
+; CHECK: <4 x float>
+define void @test_runtime_check2(float* %a, float %b, i64 %offset, i64 %offset2, i64 %n, float* %c) {
+entry:
+ br label %for.body
+
+for.body:
+ %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]
+ %ind.sum = add i64 %iv, %offset
+ %arr.idx = getelementptr inbounds float, float* %a, i64 %ind.sum
+ %l1 = load float, float* %arr.idx, align 4
+ %ind.sum2 = add i64 %iv, %offset2
+ %arr.idx2 = getelementptr inbounds float, float* %a, i64 %ind.sum2
+ %l2 = load float, float* %arr.idx2, align 4
+ %m = fmul fast float %b, %l2
+ %ad = fadd fast float %l1, %m
+ store float %ad, float* %arr.idx, align 4
+ %c.ind = add i64 %iv, -1
+ %c.idx = getelementptr inbounds float, float* %c, i64 %c.ind
+ %lc = load float, float* %c.idx, align 4
+ %vc = fadd float %lc, 1.0
+ %c.idx2 = getelementptr inbounds float, float* %c, i64 %iv
+ store float %vc, float* %c.idx2
+ %iv.next = add nuw nsw i64 %iv, 1
+ %exitcond = icmp eq i64 %iv.next, %n
+ br i1 %exitcond, label %loopexit, label %for.body
+
+loopexit:
+ ret void
+}
+
; CHECK: !9 = !DILocation(line: 101, column: 1, scope: !{{.*}})
!llvm.module.flags = !{!0, !1}
OpenPOWER on IntegriCloud