[MustExecute] Add simplest possible test for LoopSafetyOnfo

(Currently showing without, will enable and check in diff to show impact)

llvm-svn: 328056
This commit is contained in:
Philip Reames 2018-03-20 22:55:20 +00:00
parent 23aed5ef6f
commit 164b1b4e21
1 changed files with 26 additions and 0 deletions

View File

@ -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)