summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
authorPhilip Reames <listmail@philipreames.com>2018-03-20 22:55:20 +0000
committerPhilip Reames <listmail@philipreames.com>2018-03-20 22:55:20 +0000
commit164b1b4e21c5634360c7b8eb29ac1aa3ae25b01e (patch)
tree9b13c5f29eb55cc5b32129fe6255e7a7b2483af2 /llvm/test
parent23aed5ef6ff3518516688ac3c8768fdbc743563b (diff)
downloadbcm5719-llvm-164b1b4e21c5634360c7b8eb29ac1aa3ae25b01e.tar.gz
bcm5719-llvm-164b1b4e21c5634360c7b8eb29ac1aa3ae25b01e.zip
[MustExecute] Add simplest possible test for LoopSafetyOnfo
(Currently showing without, will enable and check in diff to show impact) llvm-svn: 328056
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/Analysis/MustExecute/loop-header.ll26
1 files changed, 26 insertions, 0 deletions
diff --git a/llvm/test/Analysis/MustExecute/loop-header.ll b/llvm/test/Analysis/MustExecute/loop-header.ll
index b74c3e2a317..4d4c1ff90fc 100644
--- a/llvm/test/Analysis/MustExecute/loop-header.ll
+++ b/llvm/test/Analysis/MustExecute/loop-header.ll
@@ -83,5 +83,31 @@ exit:
ret i1 false
}
+; Since all the instructions in the loop dominate the only exit
+; and there's no implicit control flow in the loop, all must execute
+; FIXME: handled by loop safety info, test it
+define i1 @nothrow_loop(i32* noalias %p, i32 %high) {
+; CHECK-LABEL: @nothrow_loop(
+; CHECK-LABEL: loop:
+; CHECK: %iv = phi i32 [ 0, %entry ], [ %iv.next, %next ] ; (mustexec in: loop)
+; CHECK: br label %next ; (mustexec in: loop)
+; CHECK-NOT: mustexec
+
+entry:
+ br label %loop
+
+loop:
+ %iv = phi i32 [0, %entry], [%iv.next, %next]
+ br label %next
+next:
+ %v = load i32, i32* %p
+ %iv.next = add nsw nuw i32 %iv, 1
+ %exit.test = icmp slt i32 %iv, %high
+ br i1 %exit.test, label %exit, label %loop
+
+exit:
+ ret i1 false
+}
+
declare void @maythrow_and_use(i32)
OpenPOWER on IntegriCloud