217 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py2; RUN: opt < %s -S -disable-output "-passes=print<scalar-evolution>" 2>&1 | FileCheck %s3 4; copied from flags-from-poison.ll5define void @test-add-nuw(ptr %input, i32 %offset, i32 %numIterations) {6; CHECK-LABEL: 'test-add-nuw'7; CHECK-NEXT: Classifying expressions for: @test-add-nuw8; CHECK-NEXT: %i = phi i32 [ %nexti, %loop ], [ 0, %entry ]9; CHECK-NEXT: --> {0,+,1}<nuw><%loop> U: full-set S: full-set Exits: (-1 + %numIterations) LoopDispositions: { %loop: Computable }10; CHECK-NEXT: %nexti = add nuw i32 %i, 111; CHECK-NEXT: --> {1,+,1}<nuw><%loop> U: [1,0) S: [1,0) Exits: %numIterations LoopDispositions: { %loop: Computable }12; CHECK-NEXT: %index32 = add nuw i32 %nexti, %offset13; CHECK-NEXT: --> {(1 + %offset)<nuw>,+,1}<nuw><%loop> U: [1,0) S: [1,0) Exits: (%offset + %numIterations) LoopDispositions: { %loop: Computable }14; CHECK-NEXT: %ptr = getelementptr inbounds float, ptr %input, i32 %index3215; CHECK-NEXT: --> ((4 * (sext i32 {(1 + %offset)<nuw>,+,1}<nuw><%loop> to i64))<nsw> + %input) U: full-set S: full-set Exits: ((4 * (sext i32 (%offset + %numIterations) to i64))<nsw> + %input) LoopDispositions: { %loop: Computable }16; CHECK-NEXT: Determining loop execution counts for: @test-add-nuw17; CHECK-NEXT: Loop %loop: backedge-taken count is (-1 + %numIterations)18; CHECK-NEXT: Loop %loop: constant max backedge-taken count is i32 -119; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (-1 + %numIterations)20; CHECK-NEXT: Loop %loop: Trip multiple is 121;22entry:23 br label %loop24loop:25 %i = phi i32 [ %nexti, %loop ], [ 0, %entry ]26 %nexti = add nuw i32 %i, 127 %index32 = add nuw i32 %nexti, %offset28 %ptr = getelementptr inbounds float, ptr %input, i32 %index3229 %f = load float, ptr %ptr, align 430 %exitcond = icmp eq i32 %nexti, %numIterations31 br i1 %exitcond, label %exit, label %loop32 33exit:34 ret void35}36 37define void @test-addrec-nuw(ptr %input, i32 %offset, i32 %numIterations) {38; CHECK-LABEL: 'test-addrec-nuw'39; CHECK-NEXT: Classifying expressions for: @test-addrec-nuw40; CHECK-NEXT: %min.10 = select i1 %cmp, i32 %offset, i32 1041; CHECK-NEXT: --> (10 smax %offset) U: [10,-2147483648) S: [10,-2147483648)42; CHECK-NEXT: %i = phi i32 [ %nexti, %loop ], [ 0, %entry ]43; CHECK-NEXT: --> {0,+,1}<nuw><%loop> U: full-set S: full-set Exits: (-1 + %numIterations) LoopDispositions: { %loop: Computable }44; CHECK-NEXT: %nexti = add nuw i32 %i, 145; CHECK-NEXT: --> {1,+,1}<nuw><%loop> U: [1,0) S: [1,0) Exits: %numIterations LoopDispositions: { %loop: Computable }46; CHECK-NEXT: %index32 = add nuw i32 %nexti, %min.1047; CHECK-NEXT: --> {(1 + (10 smax %offset))<nuw>,+,1}<nuw><%loop> U: [11,0) S: [11,0) Exits: ((10 smax %offset) + %numIterations) LoopDispositions: { %loop: Computable }48; CHECK-NEXT: %ptr = getelementptr inbounds float, ptr %input, i32 %index3249; CHECK-NEXT: --> ((4 * (sext i32 {(1 + (10 smax %offset))<nuw>,+,1}<nuw><%loop> to i64))<nsw> + %input) U: full-set S: full-set Exits: ((4 * (sext i32 ((10 smax %offset) + %numIterations) to i64))<nsw> + %input) LoopDispositions: { %loop: Computable }50; CHECK-NEXT: Determining loop execution counts for: @test-addrec-nuw51; CHECK-NEXT: Loop %loop: backedge-taken count is (-1 + %numIterations)52; CHECK-NEXT: Loop %loop: constant max backedge-taken count is i32 -153; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (-1 + %numIterations)54; CHECK-NEXT: Loop %loop: Trip multiple is 155;56entry:57 %cmp = icmp sgt i32 %offset, 1058 %min.10 = select i1 %cmp, i32 %offset, i32 1059 br label %loop60loop:61 %i = phi i32 [ %nexti, %loop ], [ 0, %entry ]62 %nexti = add nuw i32 %i, 163 %index32 = add nuw i32 %nexti, %min.1064 %ptr = getelementptr inbounds float, ptr %input, i32 %index3265 %f = load float, ptr %ptr, align 466 %exitcond = icmp eq i32 %nexti, %numIterations67 br i1 %exitcond, label %exit, label %loop68 69exit:70 ret void71}72 73define void @test-addrec-nsw-start-neg-strip-neg(ptr %input, i32 %offset, i32 %numIterations) {74; CHECK-LABEL: 'test-addrec-nsw-start-neg-strip-neg'75; CHECK-NEXT: Classifying expressions for: @test-addrec-nsw-start-neg-strip-neg76; CHECK-NEXT: %max = select i1 %cmp, i32 %offset, i32 -1077; CHECK-NEXT: --> (-10 smin %offset) U: [-2147483648,-9) S: [-2147483648,-9)78; CHECK-NEXT: %i = phi i32 [ %nexti, %loop ], [ 0, %entry ]79; CHECK-NEXT: --> {0,+,-1}<nsw><%loop> U: [-2147483648,1) S: [-2147483648,1) Exits: (1 + %numIterations) LoopDispositions: { %loop: Computable }80; CHECK-NEXT: %nexti = add nsw i32 %i, -181; CHECK-NEXT: --> {-1,+,-1}<nsw><%loop> U: [-2147483648,0) S: [-2147483648,0) Exits: %numIterations LoopDispositions: { %loop: Computable }82; CHECK-NEXT: %index32 = add nsw i32 %nexti, %max83; CHECK-NEXT: --> {(-1 + (-10 smin %offset))<nsw>,+,-1}<nsw><%loop> U: [-2147483648,-10) S: [-2147483648,-10) Exits: ((-10 smin %offset) + %numIterations) LoopDispositions: { %loop: Computable }84; CHECK-NEXT: %ptr = getelementptr inbounds float, ptr %input, i32 %index3285; CHECK-NEXT: --> {(-4 + (4 * (-10 smin (sext i32 %offset to i64)))<nsw> + %input),+,-4}<nw><%loop> U: full-set S: full-set Exits: (-4 + (4 * (-10 smin (sext i32 %offset to i64)))<nsw> + (-4 * (zext i32 (-1 + (-1 * %numIterations)) to i64))<nsw> + %input) LoopDispositions: { %loop: Computable }86; CHECK-NEXT: Determining loop execution counts for: @test-addrec-nsw-start-neg-strip-neg87; CHECK-NEXT: Loop %loop: backedge-taken count is (-1 + (-1 * %numIterations))88; CHECK-NEXT: Loop %loop: constant max backedge-taken count is i32 -189; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (-1 + (-1 * %numIterations))90; CHECK-NEXT: Loop %loop: Trip multiple is 191;92entry:93 %cmp = icmp slt i32 %offset, -1094 %max = select i1 %cmp, i32 %offset, i32 -1095 br label %loop96loop:97 %i = phi i32 [ %nexti, %loop ], [ 0, %entry ]98 %nexti = add nsw i32 %i, -199 %index32 = add nsw i32 %nexti, %max100 %ptr = getelementptr inbounds float, ptr %input, i32 %index32101 %f = load float, ptr %ptr, align 4102 %exitcond = icmp eq i32 %nexti, %numIterations103 br i1 %exitcond, label %exit, label %loop104 105exit:106 ret void107}108 109define void @test-addrec-nsw-start-pos-strip-neg(ptr %input, i32 %offset, i32 %numIterations) {110; CHECK-LABEL: 'test-addrec-nsw-start-pos-strip-neg'111; CHECK-NEXT: Classifying expressions for: @test-addrec-nsw-start-pos-strip-neg112; CHECK-NEXT: %max = select i1 %cmp, i32 %offset, i32 10113; CHECK-NEXT: --> (10 smin %offset) U: [-2147483648,11) S: [-2147483648,11)114; CHECK-NEXT: %i = phi i32 [ %nexti, %loop ], [ 0, %entry ]115; CHECK-NEXT: --> {0,+,-1}<nsw><%loop> U: [-2147483648,1) S: [-2147483648,1) Exits: (1 + %numIterations) LoopDispositions: { %loop: Computable }116; CHECK-NEXT: %nexti = add nsw i32 %i, -1117; CHECK-NEXT: --> {-1,+,-1}<nsw><%loop> U: [-2147483648,0) S: [-2147483648,0) Exits: %numIterations LoopDispositions: { %loop: Computable }118; CHECK-NEXT: %index32 = add nsw i32 %nexti, %max119; CHECK-NEXT: --> {(-1 + (10 smin %offset))<nsw>,+,-1}<nsw><%loop> U: [-2147483648,10) S: [-2147483648,10) Exits: ((10 smin %offset) + %numIterations) LoopDispositions: { %loop: Computable }120; CHECK-NEXT: %ptr = getelementptr inbounds float, ptr %input, i32 %index32121; CHECK-NEXT: --> {(-4 + (4 * (10 smin (sext i32 %offset to i64)))<nsw> + %input),+,-4}<nw><%loop> U: full-set S: full-set Exits: (-4 + (4 * (10 smin (sext i32 %offset to i64)))<nsw> + (-4 * (zext i32 (-1 + (-1 * %numIterations)) to i64))<nsw> + %input) LoopDispositions: { %loop: Computable }122; CHECK-NEXT: Determining loop execution counts for: @test-addrec-nsw-start-pos-strip-neg123; CHECK-NEXT: Loop %loop: backedge-taken count is (-1 + (-1 * %numIterations))124; CHECK-NEXT: Loop %loop: constant max backedge-taken count is i32 -1125; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (-1 + (-1 * %numIterations))126; CHECK-NEXT: Loop %loop: Trip multiple is 1127;128entry:129 %cmp = icmp slt i32 %offset, 10130 %max = select i1 %cmp, i32 %offset, i32 10131 br label %loop132loop:133 %i = phi i32 [ %nexti, %loop ], [ 0, %entry ]134 %nexti = add nsw i32 %i, -1135 %index32 = add nsw i32 %nexti, %max136 %ptr = getelementptr inbounds float, ptr %input, i32 %index32137 %f = load float, ptr %ptr, align 4138 %exitcond = icmp eq i32 %nexti, %numIterations139 br i1 %exitcond, label %exit, label %loop140 141exit:142 ret void143}144 145define void @test-addrec-nsw-start-pos-strip-pos(ptr %input, i32 %offset, i32 %numIterations) {146; CHECK-LABEL: 'test-addrec-nsw-start-pos-strip-pos'147; CHECK-NEXT: Classifying expressions for: @test-addrec-nsw-start-pos-strip-pos148; CHECK-NEXT: %min = select i1 %cmp, i32 %offset, i32 10149; CHECK-NEXT: --> (10 smax %offset) U: [10,-2147483648) S: [10,-2147483648)150; CHECK-NEXT: %i = phi i32 [ %nexti, %loop ], [ 0, %entry ]151; CHECK-NEXT: --> {0,+,1}<nuw><nsw><%loop> U: [0,-2147483648) S: [0,-2147483648) Exits: (-1 + %numIterations) LoopDispositions: { %loop: Computable }152; CHECK-NEXT: %nexti = add nsw i32 %i, 1153; CHECK-NEXT: --> {1,+,1}<nuw><nsw><%loop> U: [1,-2147483648) S: [1,-2147483648) Exits: %numIterations LoopDispositions: { %loop: Computable }154; CHECK-NEXT: %index32 = add nsw i32 %nexti, %min155; CHECK-NEXT: --> {(1 + (10 smax %offset))<nuw><nsw>,+,1}<nuw><nsw><%loop> U: [11,-2147483648) S: [11,-2147483648) Exits: ((10 smax %offset) + %numIterations) LoopDispositions: { %loop: Computable }156; CHECK-NEXT: %ptr = getelementptr inbounds float, ptr %input, i32 %index32157; CHECK-NEXT: --> {(4 + (4 * (zext i32 (10 smax %offset) to i64))<nuw><nsw> + %input)<nuw>,+,4}<nuw><%loop> U: [44,0) S: [44,0) Exits: (4 + (4 * (zext i32 (-1 + %numIterations) to i64))<nuw><nsw> + (4 * (zext i32 (10 smax %offset) to i64))<nuw><nsw> + %input) LoopDispositions: { %loop: Computable }158; CHECK-NEXT: Determining loop execution counts for: @test-addrec-nsw-start-pos-strip-pos159; CHECK-NEXT: Loop %loop: backedge-taken count is (-1 + %numIterations)160; CHECK-NEXT: Loop %loop: constant max backedge-taken count is i32 -1161; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (-1 + %numIterations)162; CHECK-NEXT: Loop %loop: Trip multiple is 1163;164entry:165 %cmp = icmp sgt i32 %offset, 10166 %min = select i1 %cmp, i32 %offset, i32 10167 br label %loop168loop:169 %i = phi i32 [ %nexti, %loop ], [ 0, %entry ]170 %nexti = add nsw i32 %i, 1171 %index32 = add nsw i32 %nexti, %min172 %ptr = getelementptr inbounds float, ptr %input, i32 %index32173 %f = load float, ptr %ptr, align 4174 %exitcond = icmp eq i32 %nexti, %numIterations175 br i1 %exitcond, label %exit, label %loop176 177exit:178 ret void179}180 181define void @test-addrec-nsw-start-neg-strip-pos(ptr %input, i32 %offset, i32 %numIterations) {182; CHECK-LABEL: 'test-addrec-nsw-start-neg-strip-pos'183; CHECK-NEXT: Classifying expressions for: @test-addrec-nsw-start-neg-strip-pos184; CHECK-NEXT: %min = select i1 %cmp, i32 %offset, i32 -10185; CHECK-NEXT: --> (-10 smax %offset) U: [-10,-2147483648) S: [-10,-2147483648)186; CHECK-NEXT: %i = phi i32 [ %nexti, %loop ], [ 0, %entry ]187; CHECK-NEXT: --> {0,+,1}<nuw><nsw><%loop> U: [0,-2147483648) S: [0,-2147483648) Exits: (-1 + %numIterations) LoopDispositions: { %loop: Computable }188; CHECK-NEXT: %nexti = add nsw i32 %i, 1189; CHECK-NEXT: --> {1,+,1}<nuw><nsw><%loop> U: [1,-2147483648) S: [1,-2147483648) Exits: %numIterations LoopDispositions: { %loop: Computable }190; CHECK-NEXT: %index32 = add nsw i32 %nexti, %min191; CHECK-NEXT: --> {(1 + (-10 smax %offset))<nsw>,+,1}<nsw><%loop> U: [-9,-2147483648) S: [-9,-2147483648) Exits: ((-10 smax %offset) + %numIterations) LoopDispositions: { %loop: Computable }192; CHECK-NEXT: %ptr = getelementptr inbounds float, ptr %input, i32 %index32193; CHECK-NEXT: --> {(4 + (4 * (-10 smax (sext i32 %offset to i64)))<nsw> + %input),+,4}<nw><%loop> U: full-set S: full-set Exits: (4 + (4 * (zext i32 (-1 + %numIterations) to i64))<nuw><nsw> + (4 * (-10 smax (sext i32 %offset to i64)))<nsw> + %input) LoopDispositions: { %loop: Computable }194; CHECK-NEXT: Determining loop execution counts for: @test-addrec-nsw-start-neg-strip-pos195; CHECK-NEXT: Loop %loop: backedge-taken count is (-1 + %numIterations)196; CHECK-NEXT: Loop %loop: constant max backedge-taken count is i32 -1197; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (-1 + %numIterations)198; CHECK-NEXT: Loop %loop: Trip multiple is 1199;200entry:201 %cmp = icmp sgt i32 %offset, -10202 %min = select i1 %cmp, i32 %offset, i32 -10203 br label %loop204loop:205 %i = phi i32 [ %nexti, %loop ], [ 0, %entry ]206 %nexti = add nsw i32 %i, 1207 %index32 = add nsw i32 %nexti, %min208 %ptr = getelementptr inbounds float, ptr %input, i32 %index32209 %f = load float, ptr %ptr, align 4210 %exitcond = icmp eq i32 %nexti, %numIterations211 br i1 %exitcond, label %exit, label %loop212 213exit:214 ret void215}216 217