summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/LoopUnroll
diff options
context:
space:
mode:
authorDavide Italiano <davide@freebsd.org>2017-04-24 20:14:11 +0000
committerDavide Italiano <davide@freebsd.org>2017-04-24 20:14:11 +0000
commit0f62eea7ff4a1c5888eecba930d87361430a053b (patch)
tree5a4246c5cadd8424d410d76ff95928ec58183ea8 /llvm/test/Transforms/LoopUnroll
parent206f65c04964a23a6072b2a6de3bf6496bb1a884 (diff)
downloadbcm5719-llvm-0f62eea7ff4a1c5888eecba930d87361430a053b.tar.gz
bcm5719-llvm-0f62eea7ff4a1c5888eecba930d87361430a053b.zip
[LoopUnroll] Don't try to unroll non canonical loops.
The current Loop Unroll implementation works with loops having a single latch that contains a conditional branch to a block outside the loop (the other successor is, by defition of latch, the header). If this precondition doesn't hold, avoid unrolling the loop as the code is not ready to handle such circumstances. Differential Revision: https://reviews.llvm.org/D32261 llvm-svn: 301239
Diffstat (limited to 'llvm/test/Transforms/LoopUnroll')
-rw-r--r--llvm/test/Transforms/LoopUnroll/not-rotated.ll26
1 files changed, 26 insertions, 0 deletions
diff --git a/llvm/test/Transforms/LoopUnroll/not-rotated.ll b/llvm/test/Transforms/LoopUnroll/not-rotated.ll
new file mode 100644
index 00000000000..ffe80920d94
--- /dev/null
+++ b/llvm/test/Transforms/LoopUnroll/not-rotated.ll
@@ -0,0 +1,26 @@
+; PR28103
+; Bail out if the two successors are not the header
+; and another bb outside of the loop. This case is not
+; properly handled by LoopUnroll, currently.
+
+; RUN: opt -loop-unroll -verify-dom-info %s
+; REQUIRE: asserts
+
+define void @tinkywinky(i1 %patatino) {
+entry:
+ br label %header1
+header1:
+ %indvars.iv = phi i64 [ 1, %body2 ], [ 0, %entry ]
+ %exitcond = icmp ne i64 %indvars.iv, 1
+ br i1 %exitcond, label %body1, label %exit
+body1:
+ br i1 %patatino, label %body2, label %sink
+body2:
+ br i1 %patatino, label %header1, label %body3
+body3:
+ br label %sink
+sink:
+ br label %body2
+exit:
+ ret void
+}
OpenPOWER on IntegriCloud