[llvm] r328056 - [MustExecute] Add simplest possible test for LoopSafetyOnfo

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 20 15:55:21 PDT 2018


Author: reames
Date: Tue Mar 20 15:55:20 2018
New Revision: 328056

URL: http://llvm.org/viewvc/llvm-project?rev=328056&view=rev
Log:
[MustExecute] Add simplest possible test for LoopSafetyOnfo

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


Modified:
    llvm/trunk/test/Analysis/MustExecute/loop-header.ll

Modified: llvm/trunk/test/Analysis/MustExecute/loop-header.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/MustExecute/loop-header.ll?rev=328056&r1=328055&r2=328056&view=diff
==============================================================================
--- llvm/trunk/test/Analysis/MustExecute/loop-header.ll (original)
+++ llvm/trunk/test/Analysis/MustExecute/loop-header.ll Tue Mar 20 15:55:20 2018
@@ -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)




More information about the llvm-commits mailing list