46 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py2; RUN: opt -disable-output "-passes=print<scalar-evolution>" < %s 2>&1 | FileCheck %s3 4; The semanics of this example are a bit subtle. The loop is required5; execute some number of times up to 1999. The compiler is free to reduce6; the number of said iterations to zero (or any value in between) if desired,7; but if it does so, the return value and the last value stored to G must8; agree. For SCEV, this translates as widenable conditions preventing exact9; exit counts from being computed, but not restricting max exit counts.10; It's tempting to say that SCEV should return a precise exit count here, but11; would result in miscompiles if transformations such as RLEV ran before12; widening of the WC.13define i32 @wc_max() {14; CHECK-LABEL: 'wc_max'15; CHECK-NEXT: Classifying expressions for: @wc_max16; CHECK-NEXT: %iv = phi i32 [ 0, %entry ], [ %iv.next, %loop ]17; CHECK-NEXT: --> {0,+,1}<nuw><nsw><%loop> U: [0,2000) S: [0,2000) Exits: <<Unknown>> LoopDispositions: { %loop: Computable }18; CHECK-NEXT: %iv.next = add i32 %iv, 119; CHECK-NEXT: --> {1,+,1}<nuw><nsw><%loop> U: [1,2001) S: [1,2001) Exits: <<Unknown>> LoopDispositions: { %loop: Computable }20; CHECK-NEXT: %widenable_cond3 = call i1 @llvm.experimental.widenable.condition()21; CHECK-NEXT: --> %widenable_cond3 U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }22; CHECK-NEXT: %exiplicit_guard_cond4 = and i1 %cond_1, %widenable_cond323; CHECK-NEXT: --> (%cond_1 umin %widenable_cond3) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }24; CHECK-NEXT: Determining loop execution counts for: @wc_max25; CHECK-NEXT: Loop %loop: Unpredictable backedge-taken count.26; CHECK-NEXT: Loop %loop: constant max backedge-taken count is i32 199927; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is i32 199928;29entry:30 br label %loop31loop:32 %iv = phi i32 [0, %entry], [%iv.next, %loop]33 %iv.next = add i32 %iv, 134 store i32 %iv, ptr @G35 %cond_1 = icmp slt i32 %iv.next, 200036 %widenable_cond3 = call i1 @llvm.experimental.widenable.condition()37 %exiplicit_guard_cond4 = and i1 %cond_1, %widenable_cond338 br i1 %exiplicit_guard_cond4, label %loop, label %exit39 40exit:41 ret i32 %iv42}43 44@G = external global i3245declare i1 @llvm.experimental.widenable.condition()46