1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192
|
; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --version 5
; RUN: opt -disable-output -passes="print<scalar-evolution>" < %s 2>&1 | FileCheck %s
define void @infer.sext.0(ptr %c, i32 %start, ptr %buf) {
; CHECK-LABEL: 'infer.sext.0'
; CHECK-NEXT: Classifying expressions for: @infer.sext.0
; CHECK-NEXT: %counter = phi i32 [ 0, %entry ], [ %counter.inc, %loop ]
; CHECK-NEXT: --> {0,+,1}<nuw><nsw><%loop> U: [0,2) S: [0,2) Exits: 1 LoopDispositions: { %loop: Computable }
; CHECK-NEXT: %idx = phi i32 [ %start, %entry ], [ %idx.inc, %loop ]
; CHECK-NEXT: --> {%start,+,1}<nsw><%loop> U: full-set S: full-set Exits: (1 + %start) LoopDispositions: { %loop: Computable }
; CHECK-NEXT: %idx.inc = add nsw i32 %idx, 1
; CHECK-NEXT: --> {(1 + %start)<nsw>,+,1}<nsw><%loop> U: full-set S: full-set Exits: (2 + %start) LoopDispositions: { %loop: Computable }
; CHECK-NEXT: %idx.inc.sext = sext i32 %idx.inc to i64
; CHECK-NEXT: --> {(1 + (sext i32 %start to i64))<nsw>,+,1}<nsw><%loop> U: [-2147483647,2147483650) S: [-2147483647,2147483650) Exits: (2 + (sext i32 %start to i64))<nsw> LoopDispositions: { %loop: Computable }
; CHECK-NEXT: %buf.gep = getelementptr inbounds i32, ptr %buf, i32 %idx.inc
; CHECK-NEXT: --> {(4 + (4 * (sext i32 %start to i64))<nsw> + %buf),+,4}<nw><%loop> U: full-set S: full-set Exits: (8 + (4 * (sext i32 %start to i64))<nsw> + %buf) LoopDispositions: { %loop: Computable }
; CHECK-NEXT: %val = load i32, ptr %buf.gep, align 4
; CHECK-NEXT: --> %val U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
; CHECK-NEXT: %counter.inc = add i32 %counter, 1
; CHECK-NEXT: --> {1,+,1}<nuw><nsw><%loop> U: [1,3) S: [1,3) Exits: 2 LoopDispositions: { %loop: Computable }
; CHECK-NEXT: Determining loop execution counts for: @infer.sext.0
; CHECK-NEXT: Loop %loop: backedge-taken count is i32 1
; CHECK-NEXT: Loop %loop: constant max backedge-taken count is i32 1
; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is i32 1
; CHECK-NEXT: Loop %loop: Trip multiple is 2
;
entry:
br label %loop
loop:
%counter = phi i32 [ 0, %entry ], [ %counter.inc, %loop ]
%idx = phi i32 [ %start, %entry ], [ %idx.inc, %loop ]
%idx.inc = add nsw i32 %idx, 1
%idx.inc.sext = sext i32 %idx.inc to i64
%buf.gep = getelementptr inbounds i32, ptr %buf, i32 %idx.inc
%val = load i32, ptr %buf.gep
%condition = icmp eq i32 %counter, 1
%counter.inc = add i32 %counter, 1
br i1 %condition, label %exit, label %loop
exit:
ret void
}
define void @infer.zext.0(ptr %c, i32 %start, ptr %buf) {
; CHECK-LABEL: 'infer.zext.0'
; CHECK-NEXT: Classifying expressions for: @infer.zext.0
; CHECK-NEXT: %counter = phi i32 [ 0, %entry ], [ %counter.inc, %loop ]
; CHECK-NEXT: --> {0,+,1}<nuw><nsw><%loop> U: [0,2) S: [0,2) Exits: 1 LoopDispositions: { %loop: Computable }
; CHECK-NEXT: %idx = phi i32 [ %start, %entry ], [ %idx.inc, %loop ]
; CHECK-NEXT: --> {%start,+,1}<nuw><%loop> U: full-set S: full-set Exits: (1 + %start) LoopDispositions: { %loop: Computable }
; CHECK-NEXT: %idx.inc = add nuw i32 %idx, 1
; CHECK-NEXT: --> {(1 + %start)<nuw>,+,1}<nuw><%loop> U: [1,0) S: [1,0) Exits: (2 + %start) LoopDispositions: { %loop: Computable }
; CHECK-NEXT: %idx.inc.sext = zext i32 %idx.inc to i64
; CHECK-NEXT: --> {(1 + (zext i32 %start to i64))<nuw><nsw>,+,1}<nuw><%loop> U: [1,4294967298) S: [1,4294967298) Exits: (2 + (zext i32 %start to i64))<nuw><nsw> LoopDispositions: { %loop: Computable }
; CHECK-NEXT: %buf.gep = getelementptr inbounds i32, ptr %buf, i32 %idx.inc
; CHECK-NEXT: --> ((4 * (sext i32 {(1 + %start)<nuw>,+,1}<nuw><%loop> to i64))<nsw> + %buf) U: full-set S: full-set Exits: ((4 * (sext i32 (2 + %start) to i64))<nsw> + %buf) LoopDispositions: { %loop: Computable }
; CHECK-NEXT: %val = load i32, ptr %buf.gep, align 4
; CHECK-NEXT: --> %val U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
; CHECK-NEXT: %counter.inc = add i32 %counter, 1
; CHECK-NEXT: --> {1,+,1}<nuw><nsw><%loop> U: [1,3) S: [1,3) Exits: 2 LoopDispositions: { %loop: Computable }
; CHECK-NEXT: Determining loop execution counts for: @infer.zext.0
; CHECK-NEXT: Loop %loop: backedge-taken count is i32 1
; CHECK-NEXT: Loop %loop: constant max backedge-taken count is i32 1
; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is i32 1
; CHECK-NEXT: Loop %loop: Trip multiple is 2
;
entry:
br label %loop
loop:
%counter = phi i32 [ 0, %entry ], [ %counter.inc, %loop ]
%idx = phi i32 [ %start, %entry ], [ %idx.inc, %loop ]
%idx.inc = add nuw i32 %idx, 1
%idx.inc.sext = zext i32 %idx.inc to i64
%buf.gep = getelementptr inbounds i32, ptr %buf, i32 %idx.inc
%val = load i32, ptr %buf.gep
%condition = icmp eq i32 %counter, 1
%counter.inc = add i32 %counter, 1
br i1 %condition, label %exit, label %loop
exit:
ret void
}
define void @infer.sext.1(i32 %start, ptr %c) {
; CHECK-LABEL: 'infer.sext.1'
; CHECK-NEXT: Classifying expressions for: @infer.sext.1
; CHECK-NEXT: %start.mul = mul i32 %start, 4
; CHECK-NEXT: --> (4 * %start) U: [0,-3) S: [-2147483648,2147483645)
; CHECK-NEXT: %start.real = add i32 %start.mul, 2
; CHECK-NEXT: --> (2 + (4 * %start))<nuw><nsw> U: [2,-1) S: [-2147483646,2147483647)
; CHECK-NEXT: %idx = phi i32 [ %start.real, %entry ], [ %idx.inc, %loop ]
; CHECK-NEXT: --> {(2 + (4 * %start))<nuw><nsw>,+,2}<nsw><%loop> U: [0,-1) S: [-2147483646,2147483647) Exits: <<Unknown>> LoopDispositions: { %loop: Computable }
; CHECK-NEXT: %idx.sext = sext i32 %idx to i64
; CHECK-NEXT: --> {(2 + (sext i32 (4 * %start) to i64))<nuw><nsw>,+,2}<nsw><%loop> U: [0,-1) S: [-2147483646,9223372036854775807) Exits: <<Unknown>> LoopDispositions: { %loop: Computable }
; CHECK-NEXT: %idx.inc = add nsw i32 %idx, 2
; CHECK-NEXT: --> {(4 + (4 * %start)),+,2}<nw><%loop> U: [0,-1) S: [-2147483648,2147483647) Exits: <<Unknown>> LoopDispositions: { %loop: Computable }
; CHECK-NEXT: %condition = load i1, ptr %c, align 1
; CHECK-NEXT: --> %condition U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
; CHECK-NEXT: Determining loop execution counts for: @infer.sext.1
; CHECK-NEXT: Loop %loop: Unpredictable backedge-taken count.
; CHECK-NEXT: Loop %loop: Unpredictable constant max backedge-taken count.
; CHECK-NEXT: Loop %loop: Unpredictable symbolic max backedge-taken count.
;
entry:
%start.mul = mul i32 %start, 4
%start.real = add i32 %start.mul, 2
br label %loop
loop:
%idx = phi i32 [ %start.real, %entry ], [ %idx.inc, %loop ]
%idx.sext = sext i32 %idx to i64
%idx.inc = add nsw i32 %idx, 2
%condition = load i1, ptr %c
br i1 %condition, label %exit, label %loop
exit:
ret void
}
define void @infer.sext.2(ptr %c, i8 %start) {
; CHECK-LABEL: 'infer.sext.2'
; CHECK-NEXT: Classifying expressions for: @infer.sext.2
; CHECK-NEXT: %start.inc = add i8 %start, 1
; CHECK-NEXT: --> (1 + %start) U: full-set S: full-set
; CHECK-NEXT: %idx = phi i8 [ %start.inc, %entry ], [ %idx.inc, %loop ]
; CHECK-NEXT: --> {(1 + %start),+,1}<nsw><%loop> U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Computable }
; CHECK-NEXT: %idx.sext = sext i8 %idx to i16
; CHECK-NEXT: --> {(1 + (sext i8 %start to i16))<nsw>,+,1}<nsw><%loop> U: [-127,-32768) S: [-127,-32768) Exits: <<Unknown>> LoopDispositions: { %loop: Computable }
; CHECK-NEXT: %idx.inc = add nsw i8 %idx, 1
; CHECK-NEXT: --> {(2 + %start),+,1}<nw><%loop> U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Computable }
; CHECK-NEXT: %condition = load volatile i1, ptr %c, align 1
; CHECK-NEXT: --> %condition U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
; CHECK-NEXT: Determining loop execution counts for: @infer.sext.2
; CHECK-NEXT: Loop %loop: Unpredictable backedge-taken count.
; CHECK-NEXT: Loop %loop: Unpredictable constant max backedge-taken count.
; CHECK-NEXT: Loop %loop: Unpredictable symbolic max backedge-taken count.
;
entry:
%start.inc = add i8 %start, 1
%entry.condition = icmp slt i8 %start, 127
br i1 %entry.condition, label %loop, label %exit
loop:
%idx = phi i8 [ %start.inc, %entry ], [ %idx.inc, %loop ]
%idx.sext = sext i8 %idx to i16
%idx.inc = add nsw i8 %idx, 1
%condition = load volatile i1, ptr %c
br i1 %condition, label %exit, label %loop
exit:
ret void
}
define void @infer.zext.1(ptr %c, i8 %start) {
; CHECK-LABEL: 'infer.zext.1'
; CHECK-NEXT: Classifying expressions for: @infer.zext.1
; CHECK-NEXT: %start.inc = add i8 %start, 1
; CHECK-NEXT: --> (1 + %start) U: full-set S: full-set
; CHECK-NEXT: %idx = phi i8 [ %start.inc, %entry ], [ %idx.inc, %loop ]
; CHECK-NEXT: --> {(1 + %start),+,1}<nuw><%loop> U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Computable }
; CHECK-NEXT: %idx.zext = zext i8 %idx to i16
; CHECK-NEXT: --> {(1 + (zext i8 %start to i16))<nuw><nsw>,+,1}<nuw><%loop> U: [1,0) S: [1,0) Exits: <<Unknown>> LoopDispositions: { %loop: Computable }
; CHECK-NEXT: %idx.inc = add nuw i8 %idx, 1
; CHECK-NEXT: --> {(2 + %start),+,1}<nw><%loop> U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Computable }
; CHECK-NEXT: %condition = load volatile i1, ptr %c, align 1
; CHECK-NEXT: --> %condition U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
; CHECK-NEXT: Determining loop execution counts for: @infer.zext.1
; CHECK-NEXT: Loop %loop: Unpredictable backedge-taken count.
; CHECK-NEXT: Loop %loop: Unpredictable constant max backedge-taken count.
; CHECK-NEXT: Loop %loop: Unpredictable symbolic max backedge-taken count.
;
entry:
%start.inc = add i8 %start, 1
%entry.condition = icmp ult i8 %start, 255
br i1 %entry.condition, label %loop, label %exit
loop:
%idx = phi i8 [ %start.inc, %entry ], [ %idx.inc, %loop ]
%idx.zext = zext i8 %idx to i16
%idx.inc = add nuw i8 %idx, 1
%condition = load volatile i1, ptr %c
br i1 %condition, label %exit, label %loop
exit:
ret void
}
|