1 ; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --version 2
2 ; RUN: opt -passes='print<scalar-evolution>' -disable-output %s 2>&1 | FileCheck %s
4 define i64 @alloca_non_null() {
5 ; CHECK-LABEL: 'alloca_non_null'
6 ; CHECK-NEXT: Classifying expressions for: @alloca_non_null
7 ; CHECK-NEXT: %alloca = alloca i32, align 4
8 ; CHECK-NEXT: --> %alloca U: [4,-7) S: [-9223372036854775808,9223372036854775805)
9 ; CHECK-NEXT: %int = ptrtoint ptr %alloca to i64
10 ; CHECK-NEXT: --> (ptrtoint ptr %alloca to i64) U: [4,-7) S: [-9223372036854775808,9223372036854775805)
11 ; CHECK-NEXT: Determining loop execution counts for: @alloca_non_null
13 %alloca = alloca i32, align 4
14 %int = ptrtoint ptr %alloca to i64
18 define i64 @alloca_maybe_null() {
19 ; CHECK-LABEL: 'alloca_maybe_null'
20 ; CHECK-NEXT: Classifying expressions for: @alloca_maybe_null
21 ; CHECK-NEXT: %alloca = alloca i32, align 4, addrspace(1)
22 ; CHECK-NEXT: --> %alloca U: [0,-7) S: [-9223372036854775808,9223372036854775805)
23 ; CHECK-NEXT: %int = ptrtoint ptr addrspace(1) %alloca to i64
24 ; CHECK-NEXT: --> (ptrtoint ptr addrspace(1) %alloca to i64) U: [0,-7) S: [-9223372036854775808,9223372036854775805)
25 ; CHECK-NEXT: Determining loop execution counts for: @alloca_maybe_null
27 %alloca = alloca i32, align 4, addrspace(1)
28 %int = ptrtoint ptr addrspace(1) %alloca to i64
32 define void @alloca_icmp_null_exit_count() {
33 ; CHECK-LABEL: 'alloca_icmp_null_exit_count'
34 ; CHECK-NEXT: Classifying expressions for: @alloca_icmp_null_exit_count
35 ; CHECK-NEXT: %alloca = alloca [3 x i32], align 4
36 ; CHECK-NEXT: --> %alloca U: [4,-15) S: [-9223372036854775808,9223372036854775805)
37 ; CHECK-NEXT: %alloca.end = getelementptr inbounds i32, ptr %alloca, i64 3
38 ; CHECK-NEXT: --> (12 + %alloca)<nuw> U: [16,-3) S: [-9223372036854775808,9223372036854775805)
39 ; CHECK-NEXT: %ptr = phi ptr [ %ptr.next, %loop ], [ %alloca, %entry ]
40 ; CHECK-NEXT: --> {%alloca,+,4}<nuw><%loop> U: [4,-7) S: [-9223372036854775808,9223372036854775805) Exits: (8 + %alloca)<nuw> LoopDispositions: { %loop: Computable }
41 ; CHECK-NEXT: %ptr.next = getelementptr i32, ptr %ptr, i64 1
42 ; CHECK-NEXT: --> {(4 + %alloca)<nuw>,+,4}<nuw><%loop> U: [8,-3) S: [-9223372036854775808,9223372036854775805) Exits: (12 + %alloca)<nuw> LoopDispositions: { %loop: Computable }
43 ; CHECK-NEXT: %and = and i1 %cmp1, %cmp2
44 ; CHECK-NEXT: --> (%cmp2 umin %cmp1) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
45 ; CHECK-NEXT: Determining loop execution counts for: @alloca_icmp_null_exit_count
46 ; CHECK-NEXT: Loop %loop: backedge-taken count is 2
47 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is 2
48 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is 2
49 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is 2
50 ; CHECK-NEXT: Predicates:
51 ; CHECK-NEXT: Loop %loop: Trip multiple is 3
54 %alloca = alloca [3 x i32], align 4
55 %alloca.end = getelementptr inbounds i32, ptr %alloca, i64 3
59 %ptr = phi ptr [ %ptr.next, %loop ], [ %alloca, %entry ]
60 %ptr.next = getelementptr i32, ptr %ptr, i64 1
61 %cmp1 = icmp ne ptr %ptr.next, %alloca.end
62 %cmp2 = icmp ne ptr %ptr.next, null
63 %and = and i1 %cmp1, %cmp2
64 br i1 %and, label %loop, label %exit