xref: /llvm-project/llvm/test/Analysis/ScalarEvolution/trip-count-switch.ll (revision 0d38f21e4ab7fe7cebe76a9d7c218ec54dba1e98)
1; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --version 4
2; RUN: opt < %s -disable-output "-passes=print<scalar-evolution>" -scalar-evolution-classify-expressions=0 2>&1 | FileCheck %s
3
4declare void @foo()
5
6define void @test1() nounwind {
7;
8; CHECK-LABEL: 'test1'
9; CHECK-NEXT:  Determining loop execution counts for: @test1
10; CHECK-NEXT:  Loop %for.cond: backedge-taken count is i32 2
11; CHECK-NEXT:  Loop %for.cond: constant max backedge-taken count is i32 2
12; CHECK-NEXT:  Loop %for.cond: symbolic max backedge-taken count is i32 2
13; CHECK-NEXT:  Loop %for.cond: Trip multiple is 3
14;
15entry:
16  br label %for.cond
17
18for.cond:                                         ; preds = %if.end, %entry
19  %i.0 = phi i32 [ 2, %entry ], [ %dec, %if.end ]
20  switch i32 %i.0, label %if.end [
21    i32 0, label %for.end
22    i32 1, label %if.then
23  ]
24
25if.then:                                          ; preds = %for.cond
26  tail call void @foo()
27  br label %if.end
28
29if.end:                                           ; preds = %for.cond, %if.then
30  %dec = add nsw i32 %i.0, -1
31  br label %for.cond
32
33for.end:                                          ; preds = %for.cond
34  ret void
35
36}
37