; CHECK: Loop %while.body: Trip multiple is 1
;
%shr = lshr i32 %blockSize, 2
- %guard = icmp ult i32 %blockSize, 4
- br i1 %guard, label %while.end, label %while.body.preheader
+ %guard = icmp uge i32 %blockSize, 4
+ br i1 %guard, label %while.body.preheader, label %while.end
while.body.preheader:
br label %while.body
; CHECK: Loop %while.body: Trip multiple is 1
;
%shr = lshr i32 %blockSize, 2
- %guard = icmp ule i32 %blockSize, 3
- br i1 %guard, label %while.end, label %while.body.preheader
+ %guard = icmp ugt i32 %blockSize, 3
+ br i1 %guard, label %while.body.preheader, label %while.end
+
+while.body.preheader:
+ br label %while.body
+
+while.body:
+ %iv = phi i32 [ %dec, %while.body ], [ %shr, %while.body.preheader ]
+ %dec = add i32 %iv, -1
+ %cmp.not = icmp eq i32 %dec, 0
+ br i1 %cmp.not, label %while.end.loopexit, label %while.body
+
+while.end.loopexit:
+ br label %while.end
+
+while.end:
+ ret void
+}
+
+define void @test_guard_uge_and_ule(i32 %blockSize) {
+; CHECK-LABEL: 'test_guard_uge_and_ule'
+; CHECK-NEXT: Classifying expressions for: @test_guard_uge_and_ule
+; CHECK-NEXT: %shr = lshr i32 %blockSize, 2
+; CHECK-NEXT: --> (%blockSize /u 4) U: [0,1073741824) S: [0,1073741824)
+; CHECK-NEXT: %iv = phi i32 [ %dec, %while.body ], [ %shr, %while.body.preheader ]
+; CHECK-NEXT: --> {(%blockSize /u 4),+,-1}<%while.body> U: full-set S: full-set Exits: 1 LoopDispositions: { %while.body: Computable }
+; CHECK-NEXT: %dec = add i32 %iv, -1
+; CHECK-NEXT: --> {(-1 + (%blockSize /u 4))<nsw>,+,-1}<%while.body> U: full-set S: full-set Exits: 0 LoopDispositions: { %while.body: Computable }
+; CHECK-NEXT: Determining loop execution counts for: @test_guard_uge_and_ule
+; CHECK-NEXT: Loop %while.body: backedge-taken count is (-1 + (%blockSize /u 4))<nsw>
+; CHECK-NEXT: Loop %while.body: max backedge-taken count is -1
+; CHECK-NEXT: Loop %while.body: Predicated backedge-taken count is (-1 + (%blockSize /u 4))<nsw>
+; CHECK-NEXT: Predicates:
+; CHECK: Loop %while.body: Trip multiple is 1
+;
+ %shr = lshr i32 %blockSize, 2
+ %guard1 = icmp uge i32 %blockSize, 4
+ br i1 %guard1, label %while.guard, label %while.end
+
+while.guard:
+ %guard2 = icmp ule i32 %blockSize, 1024
+ br i1 %guard2, label %while.body.preheader, label %while.end
+
+while.body.preheader:
+ br label %while.body
+
+while.body:
+ %iv = phi i32 [ %dec, %while.body ], [ %shr, %while.body.preheader ]
+ %dec = add i32 %iv, -1
+ %cmp.not = icmp eq i32 %dec, 0
+ br i1 %cmp.not, label %while.end.loopexit, label %while.body
+
+while.end.loopexit:
+ br label %while.end
+
+while.end:
+ ret void
+}
+
+define void @test_guard_ugt_and_ult(i32 %blockSize) {
+; CHECK-LABEL: 'test_guard_ugt_and_ult'
+; CHECK-NEXT: Classifying expressions for: @test_guard_ugt_and_ult
+; CHECK-NEXT: %shr = lshr i32 %blockSize, 2
+; CHECK-NEXT: --> (%blockSize /u 4) U: [0,1073741824) S: [0,1073741824)
+; CHECK-NEXT: %iv = phi i32 [ %dec, %while.body ], [ %shr, %while.body.preheader ]
+; CHECK-NEXT: --> {(%blockSize /u 4),+,-1}<%while.body> U: full-set S: full-set Exits: 1 LoopDispositions: { %while.body: Computable }
+; CHECK-NEXT: %dec = add i32 %iv, -1
+; CHECK-NEXT: --> {(-1 + (%blockSize /u 4))<nsw>,+,-1}<%while.body> U: full-set S: full-set Exits: 0 LoopDispositions: { %while.body: Computable }
+; CHECK-NEXT: Determining loop execution counts for: @test_guard_ugt_and_ult
+; CHECK-NEXT: Loop %while.body: backedge-taken count is (-1 + (%blockSize /u 4))<nsw>
+; CHECK-NEXT: Loop %while.body: max backedge-taken count is -1
+; CHECK-NEXT: Loop %while.body: Predicated backedge-taken count is (-1 + (%blockSize /u 4))<nsw>
+; CHECK-NEXT: Predicates:
+; CHECK: Loop %while.body: Trip multiple is 1
+;
+ %shr = lshr i32 %blockSize, 2
+ %guard1 = icmp ugt i32 %blockSize, 3
+ br i1 %guard1, label %while.guard, label %while.end
+
+while.guard:
+ %guard2 = icmp ult i32 %blockSize, 1025
+ br i1 %guard2, label %while.body.preheader, label %while.end
while.body.preheader:
br label %while.body