diff options
Diffstat (limited to 'test/Analysis/ScalarEvolution/trip-count10.ll')
-rw-r--r-- | test/Analysis/ScalarEvolution/trip-count10.ll | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/test/Analysis/ScalarEvolution/trip-count10.ll b/test/Analysis/ScalarEvolution/trip-count10.ll index 0a992f9..546e1dc 100644 --- a/test/Analysis/ScalarEvolution/trip-count10.ll +++ b/test/Analysis/ScalarEvolution/trip-count10.ll @@ -74,3 +74,53 @@ loop: return: ret void } + +; Trip counts for non-polynomial iterations. It's theoretically possible +; to compute a maximum count for these, but short of that, ScalarEvolution +; should return unknown. + +; PR7416 +; CHECK: Determining loop execution counts for: @nonpolynomial +; CHECK-NEXT: Loop %loophead: Unpredictable backedge-taken count +; CHECK-NEXT: Loop %loophead: Unpredictable max backedge-taken count + +declare i1 @g() nounwind + +define void @nonpolynomial() { +entry: + br label %loophead +loophead: + %x = phi i32 [0, %entry], [%x.1, %bb1], [%x.2, %bb2] + %y = icmp slt i32 %x, 100 + br i1 %y, label %loopbody, label %retbb +loopbody: + %z = call i1 @g() + br i1 %z, label %bb1, label %bb2 +bb1: + %x.1 = add i32 %x, 2 + br label %loophead +bb2: + %x.2 = add i32 %x, 3 + br label %loophead +retbb: + ret void +} + +; PHI nodes with all constant operands. + +; CHECK: Determining loop execution counts for: @constant_phi_operands +; CHECK: Loop %loop: backedge-taken count is 1 +; CHECK: Loop %loop: max backedge-taken count is 1 + +define void @constant_phi_operands() nounwind { +entry: + br label %loop + +loop: + %i = phi i64 [ 1, %loop ], [ 0, %entry ] + %exitcond = icmp eq i64 %i, 1 + br i1 %exitcond, label %return, label %loop + +return: + ret void +} |