|
| 1 | +; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py |
| 2 | +; RUN: opt < %s -disable-output "-passes=print<scalar-evolution>" -scalar-evolution-max-iterations=0 -scalar-evolution-classify-expressions=0 2>&1 | FileCheck %s |
| 3 | + |
| 4 | +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" |
| 5 | +target triple = "x86_64-unknown-linux-gnu" |
| 6 | + |
| 7 | +declare void @non_exit_use(i32 %i) #0 |
| 8 | + |
| 9 | +define void @SLE(i32 %len) willreturn { |
| 10 | +; CHECK-LABEL: 'SLE' |
| 11 | +; CHECK-NEXT: Determining loop execution counts for: @SLE |
| 12 | +; CHECK-NEXT: Loop %for.body: backedge-taken count is (0 smax (1 + %len)<nsw>) |
| 13 | +; CHECK-NEXT: Loop %for.body: max backedge-taken count is 2147483647 |
| 14 | +; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is (0 smax (1 + %len)<nsw>) |
| 15 | +; CHECK-NEXT: Predicates: |
| 16 | +; |
| 17 | +entry: |
| 18 | + br label %for.body |
| 19 | + |
| 20 | +for.body: |
| 21 | + %iv = phi i32 [ %inc, %for.body ], [ 0, %entry ] |
| 22 | + call void @non_exit_use(i32 %iv) nounwind willreturn |
| 23 | + %inc = add i32 %iv, 1 |
| 24 | + %cmp = icmp sle i32 %iv, %len |
| 25 | + br i1 %cmp, label %for.body, label %for.end |
| 26 | + |
| 27 | +for.end: |
| 28 | + ret void |
| 29 | +} |
| 30 | + |
| 31 | +define void @SLE_infinite(i32 %len) { |
| 32 | +; CHECK-LABEL: 'SLE_infinite' |
| 33 | +; CHECK-NEXT: Determining loop execution counts for: @SLE_infinite |
| 34 | +; CHECK-NEXT: Loop %for.body: Unpredictable backedge-taken count. |
| 35 | +; CHECK-NEXT: Loop %for.body: Unpredictable max backedge-taken count. |
| 36 | +; |
| 37 | +entry: |
| 38 | + br label %for.body |
| 39 | + |
| 40 | +for.body: |
| 41 | + %iv = phi i32 [ %inc, %for.body ], [ 0, %entry ] |
| 42 | + call void @non_exit_use(i32 %iv) nounwind willreturn |
| 43 | + %inc = add i32 %iv, 1 |
| 44 | + %cmp = icmp sle i32 %iv, %len |
| 45 | + br i1 %cmp, label %for.body, label %for.end |
| 46 | + |
| 47 | +for.end: |
| 48 | + ret void |
| 49 | +} |
| 50 | + |
| 51 | +define void @ULE(i32 %len) willreturn { |
| 52 | +; CHECK-LABEL: 'ULE' |
| 53 | +; CHECK-NEXT: Determining loop execution counts for: @ULE |
| 54 | +; CHECK-NEXT: Loop %for.body: backedge-taken count is (1 + %len)<nuw> |
| 55 | +; CHECK-NEXT: Loop %for.body: max backedge-taken count is -1 |
| 56 | +; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is (1 + %len)<nuw> |
| 57 | +; CHECK-NEXT: Predicates: |
| 58 | +; |
| 59 | +entry: |
| 60 | + br label %for.body |
| 61 | + |
| 62 | +for.body: |
| 63 | + %iv = phi i32 [ %inc, %for.body ], [ 0, %entry ] |
| 64 | + call void @non_exit_use(i32 %iv) nounwind willreturn |
| 65 | + %inc = add i32 %iv, 1 |
| 66 | + %cmp = icmp ule i32 %iv, %len |
| 67 | + br i1 %cmp, label %for.body, label %for.end |
| 68 | + |
| 69 | +for.end: |
| 70 | + ret void |
| 71 | +} |
| 72 | + |
| 73 | +define void @ULE_infinite(i32 %len) { |
| 74 | +; CHECK-LABEL: 'ULE_infinite' |
| 75 | +; CHECK-NEXT: Determining loop execution counts for: @ULE_infinite |
| 76 | +; CHECK-NEXT: Loop %for.body: Unpredictable backedge-taken count. |
| 77 | +; CHECK-NEXT: Loop %for.body: Unpredictable max backedge-taken count. |
| 78 | +; |
| 79 | +entry: |
| 80 | + br label %for.body |
| 81 | + |
| 82 | +for.body: |
| 83 | + %iv = phi i32 [ %inc, %for.body ], [ 0, %entry ] |
| 84 | + call void @non_exit_use(i32 %iv) nounwind willreturn |
| 85 | + %inc = add i32 %iv, 1 |
| 86 | + %cmp = icmp ule i32 %iv, %len |
| 87 | + br i1 %cmp, label %for.body, label %for.end |
| 88 | + |
| 89 | +for.end: |
| 90 | + ret void |
| 91 | +} |
| 92 | + |
| 93 | +define void @SGE(i32 %end) willreturn { |
| 94 | +; CHECK-LABEL: 'SGE' |
| 95 | +; CHECK-NEXT: Determining loop execution counts for: @SGE |
| 96 | +; CHECK-NEXT: Loop %for.body: backedge-taken count is (100 + (-1 * (100 smin (-1 + %end)<nsw>))) |
| 97 | +; CHECK-NEXT: Loop %for.body: max backedge-taken count is -2147483548 |
| 98 | +; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is (100 + (-1 * (100 smin (-1 + %end)<nsw>))) |
| 99 | +; CHECK-NEXT: Predicates: |
| 100 | +; |
| 101 | +entry: |
| 102 | + br label %for.body |
| 103 | + |
| 104 | +for.body: |
| 105 | + %iv = phi i32 [ %inc, %for.body ], [ 100, %entry ] |
| 106 | + call void @non_exit_use(i32 %iv) nounwind willreturn |
| 107 | + %inc = add i32 %iv, -1 |
| 108 | + %cmp = icmp sge i32 %iv, %end |
| 109 | + br i1 %cmp, label %for.body, label %for.end |
| 110 | + |
| 111 | +for.end: |
| 112 | + ret void |
| 113 | +} |
| 114 | + |
| 115 | +define void @SGE_infinite(i32 %end) { |
| 116 | +; CHECK-LABEL: 'SGE_infinite' |
| 117 | +; CHECK-NEXT: Determining loop execution counts for: @SGE_infinite |
| 118 | +; CHECK-NEXT: Loop %for.body: Unpredictable backedge-taken count. |
| 119 | +; CHECK-NEXT: Loop %for.body: Unpredictable max backedge-taken count. |
| 120 | +; |
| 121 | +entry: |
| 122 | + br label %for.body |
| 123 | + |
| 124 | +for.body: |
| 125 | + %iv = phi i32 [ %inc, %for.body ], [ 100, %entry ] |
| 126 | + call void @non_exit_use(i32 %iv) nounwind willreturn |
| 127 | + %inc = add i32 %iv, -1 |
| 128 | + %cmp = icmp sge i32 %iv, %end |
| 129 | + br i1 %cmp, label %for.body, label %for.end |
| 130 | + |
| 131 | +for.end: |
| 132 | + ret void |
| 133 | +} |
| 134 | + |
| 135 | +define void @UGE(i32 %end) willreturn { |
| 136 | +; CHECK-LABEL: 'UGE' |
| 137 | +; CHECK-NEXT: Determining loop execution counts for: @UGE |
| 138 | +; CHECK-NEXT: Loop %for.body: backedge-taken count is (100 + (-1 * (100 umin (-1 + %end)))<nsw>)<nsw> |
| 139 | +; CHECK-NEXT: Loop %for.body: max backedge-taken count is 100 |
| 140 | +; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is (100 + (-1 * (100 umin (-1 + %end)))<nsw>)<nsw> |
| 141 | +; CHECK-NEXT: Predicates: |
| 142 | +; |
| 143 | +entry: |
| 144 | + br label %for.body |
| 145 | + |
| 146 | +for.body: |
| 147 | + %iv = phi i32 [ %inc, %for.body ], [ 100, %entry ] |
| 148 | + call void @non_exit_use(i32 %iv) nounwind willreturn |
| 149 | + %inc = add i32 %iv, -1 |
| 150 | + %cmp = icmp uge i32 %iv, %end |
| 151 | + br i1 %cmp, label %for.body, label %for.end |
| 152 | + |
| 153 | +for.end: |
| 154 | + ret void |
| 155 | +} |
| 156 | + |
| 157 | +define void @UGE_infinite(i32 %end) { |
| 158 | +; CHECK-LABEL: 'UGE_infinite' |
| 159 | +; CHECK-NEXT: Determining loop execution counts for: @UGE_infinite |
| 160 | +; CHECK-NEXT: Loop %for.body: Unpredictable backedge-taken count. |
| 161 | +; CHECK-NEXT: Loop %for.body: Unpredictable max backedge-taken count. |
| 162 | +; |
| 163 | +entry: |
| 164 | + br label %for.body |
| 165 | + |
| 166 | +for.body: |
| 167 | + %iv = phi i32 [ %inc, %for.body ], [ 100, %entry ] |
| 168 | + call void @non_exit_use(i32 %iv) nounwind willreturn |
| 169 | + %inc = add i32 %iv, -1 |
| 170 | + %cmp = icmp uge i32 %iv, %end |
| 171 | + br i1 %cmp, label %for.body, label %for.end |
| 172 | + |
| 173 | +for.end: |
| 174 | + ret void |
| 175 | +} |
0 commit comments