llvm.org GIT mirror llvm / eec6984
[MustExecute] Add simplest possible test for LoopSafetyOnfo (Currently showing without, will enable and check in diff to show impact) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@328056 91177308-0d34-0410-b5e6-96231b3b80d8 Philip Reames 2 years ago
1 changed file(s) with 26 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
8282 ret i1 false
8383 }
8484
85 ; Since all the instructions in the loop dominate the only exit
86 ; and there's no implicit control flow in the loop, all must execute
87 ; FIXME: handled by loop safety info, test it
88 define i1 @nothrow_loop(i32* noalias %p, i32 %high) {
89 ; CHECK-LABEL: @nothrow_loop(
90 ; CHECK-LABEL: loop:
91 ; CHECK: %iv = phi i32 [ 0, %entry ], [ %iv.next, %next ] ; (mustexec in: loop)
92 ; CHECK: br label %next ; (mustexec in: loop)
93 ; CHECK-NOT: mustexec
94
95 entry:
96 br label %loop
97
98 loop:
99 %iv = phi i32 [0, %entry], [%iv.next, %next]
100 br label %next
101 next:
102 %v = load i32, i32* %p
103 %iv.next = add nsw nuw i32 %iv, 1
104 %exit.test = icmp slt i32 %iv, %high
105 br i1 %exit.test, label %exit, label %loop
106
107 exit:
108 ret i1 false
109 }
110
85111
86112 declare void @maythrow_and_use(i32)