1 ; RUN: opt < %s -S -disable-output "-passes=print<scalar-evolution>" 2>&1 | FileCheck %s
3 ; This file is conceptually part of flags-from-poison.ll except that the
4 ; test does not successfully auto-update via utils/update_analysis_tests_checks.sh
6 ; Subtraction of two recurrences. The addition in the SCEV that this
7 ; maps to is NSW, but the negation of the RHS does not since that
8 ; recurrence could be the most negative representable value.
9 define void @subrecurrences(i32 %outer_l, i32 %inner_l, i32 %val) {
10 ; CHECK-LABEL: 'subrecurrences'
11 ; CHECK-NEXT: Classifying expressions for: @subrecurrences
12 ; CHECK-NEXT: %o_idx = phi i32 [ 0, %entry ], [ %o_idx.inc, %outer.be ]
13 ; CHECK-NEXT: --> {0,+,1}<nuw><nsw><%outer> U: [0,-2147483648) S: [0,-2147483648) Exits: %outer_l LoopDispositions: { %outer: Computable, %inner: Invariant }
14 ; CHECK-NEXT: %o_idx.inc = add nsw i32 %o_idx, 1
15 ; CHECK-NEXT: --> {1,+,1}<nuw><%outer> U: [1,0) S: [1,0) Exits: (1 + %outer_l) LoopDispositions: { %outer: Computable, %inner: Invariant }
16 ; CHECK-NEXT: %i_idx = phi i32 [ 0, %outer ], [ %i_idx.inc, %inner ]
17 ; CHECK-NEXT: --> {0,+,1}<nuw><nsw><%inner> U: [0,-2147483648) S: [0,-2147483648) Exits: %inner_l LoopDispositions: { %inner: Computable, %outer: Variant }
18 ; CHECK-NEXT: %i_idx.inc = add nsw i32 %i_idx, 1
19 ; CHECK-NEXT: --> {1,+,1}<nuw><%inner> U: [1,0) S: [1,0) Exits: (1 + %inner_l) LoopDispositions: { %inner: Computable, %outer: Variant }
20 ; CHECK-NEXT: %v = sub nsw i32 %i_idx, %o_idx.inc
22 ; NOTE: Line deleted from autogen output due to format confusing regex matcher
23 ; CHECK-NEXT: %forub = udiv i32 1, %v
25 ; NOTE: Line deleted from autogen output due to format confusing regex matcher
26 ; CHECK-NEXT: Determining loop execution counts for: @subrecurrences
27 ; CHECK-NEXT: Loop %inner: backedge-taken count is %inner_l
28 ; CHECK-NEXT: Loop %inner: max backedge-taken count is -1
29 ; CHECK-NEXT: Loop %inner: Predicated backedge-taken count is %inner_l
30 ; CHECK-NEXT: Predicates:
31 ; CHECK: Loop %inner: Trip multiple is 1
32 ; CHECK-NEXT: Loop %outer: backedge-taken count is %outer_l
33 ; CHECK-NEXT: Loop %outer: max backedge-taken count is -1
34 ; CHECK-NEXT: Loop %outer: Predicated backedge-taken count is %outer_l
35 ; CHECK-NEXT: Predicates:
36 ; CHECK: Loop %outer: Trip multiple is 1
42 %o_idx = phi i32 [ 0, %entry ], [ %o_idx.inc, %outer.be ]
43 %o_idx.inc = add nsw i32 %o_idx, 1
44 %cond = icmp eq i32 %o_idx, %val
45 br i1 %cond, label %inner, label %outer.be
48 %i_idx = phi i32 [ 0, %outer ], [ %i_idx.inc, %inner ]
49 %i_idx.inc = add nsw i32 %i_idx, 1
50 %v = sub nsw i32 %i_idx, %o_idx.inc
51 %forub = udiv i32 1, %v
52 %cond2 = icmp eq i32 %i_idx, %inner_l
53 br i1 %cond2, label %outer.be, label %inner
56 %cond3 = icmp eq i32 %o_idx, %outer_l
57 br i1 %cond3, label %exit, label %outer