1 ; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
2 ; RUN: opt < %s -disable-output "-passes=print<scalar-evolution>" 2>&1 | FileCheck %s
4 define void @merge_values_with_ranges(ptr %a_len_ptr, ptr %b_len_ptr, i1 %unknown_cond) {
5 ; CHECK-LABEL: 'merge_values_with_ranges'
6 ; CHECK-NEXT: Classifying expressions for: @merge_values_with_ranges
7 ; CHECK-NEXT: %len_a = load i32, ptr %a_len_ptr, align 4, !range !0
8 ; CHECK-NEXT: --> %len_a U: [0,2147483647) S: [0,2147483647)
9 ; CHECK-NEXT: %len_b = load i32, ptr %b_len_ptr, align 4, !range !0
10 ; CHECK-NEXT: --> %len_b U: [0,2147483647) S: [0,2147483647)
11 ; CHECK-NEXT: %len = phi i32 [ %len_a, %if.true ], [ %len_b, %if.false ]
12 ; CHECK-NEXT: --> %len U: [0,2147483647) S: [0,2147483647)
13 ; CHECK-NEXT: Determining loop execution counts for: @merge_values_with_ranges
17 br i1 %unknown_cond, label %if.true, label %if.false
20 %len_a = load i32, ptr %a_len_ptr, !range !0
24 %len_b = load i32, ptr %b_len_ptr, !range !0
28 %len = phi i32 [ %len_a, %if.true ], [ %len_b, %if.false ]
32 define void @merge_values_with_ranges_looped(ptr %a_len_ptr, ptr %b_len_ptr) {
33 ; TODO: We could be much smarter here. So far we just make sure that we do not
34 ; go into infinite loop analyzing these Phis.
35 ; CHECK-LABEL: 'merge_values_with_ranges_looped'
36 ; CHECK-NEXT: Classifying expressions for: @merge_values_with_ranges_looped
37 ; CHECK-NEXT: %len_a = load i32, ptr %a_len_ptr, align 4, !range !0
38 ; CHECK-NEXT: --> %len_a U: [0,2147483647) S: [0,2147483647)
39 ; CHECK-NEXT: %len_b = load i32, ptr %b_len_ptr, align 4, !range !0
40 ; CHECK-NEXT: --> %len_b U: [0,2147483647) S: [0,2147483647)
41 ; CHECK-NEXT: %p1 = phi i32 [ %len_a, %entry ], [ %p2, %loop ]
42 ; CHECK-NEXT: --> %p1 U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
43 ; CHECK-NEXT: %p2 = phi i32 [ %len_b, %entry ], [ %p1, %loop ]
44 ; CHECK-NEXT: --> %p2 U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
45 ; CHECK-NEXT: %iv = phi i32 [ 0, %entry ], [ %iv.next, %loop ]
46 ; CHECK-NEXT: --> {0,+,1}<nuw><nsw><%loop> U: [0,100) S: [0,100) Exits: 99 LoopDispositions: { %loop: Computable }
47 ; CHECK-NEXT: %iv.next = add i32 %iv, 1
48 ; CHECK-NEXT: --> {1,+,1}<nuw><nsw><%loop> U: [1,101) S: [1,101) Exits: 100 LoopDispositions: { %loop: Computable }
49 ; CHECK-NEXT: Determining loop execution counts for: @merge_values_with_ranges_looped
50 ; CHECK-NEXT: Loop %loop: backedge-taken count is 99
51 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is 99
52 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is 99
53 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is 99
54 ; CHECK-NEXT: Predicates:
55 ; CHECK-NEXT: Loop %loop: Trip multiple is 100
59 %len_a = load i32, ptr %a_len_ptr, !range !0
60 %len_b = load i32, ptr %b_len_ptr, !range !0
64 %p1 = phi i32 [ %len_a, %entry ], [ %p2, %loop ]
65 %p2 = phi i32 [ %len_b, %entry ], [ %p1, %loop ]
66 %iv = phi i32 [ 0, %entry ], [ %iv.next, %loop ]
67 %iv.next = add i32 %iv, 1
68 %loop.cond = icmp slt i32 %iv.next, 100
69 br i1 %loop.cond, label %loop, label %exit
76 !0 = !{i32 0, i32 2147483647}