59 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; This file is conceptually part of flags-from-poison.ll except that the5; test does not successfully auto-update via utils/update_analysis_tests_checks.sh6 7; Subtraction of two recurrences. The addition in the SCEV that this8; maps to is NSW, but the negation of the RHS does not since that9; recurrence could be the most negative representable value.10define void @subrecurrences(i32 %outer_l, i32 %inner_l, i32 %val) {11; CHECK-LABEL: 'subrecurrences'12; CHECK-NEXT: Classifying expressions for: @subrecurrences13; CHECK-NEXT: %o_idx = phi i32 [ 0, %entry ], [ %o_idx.inc, %outer.be ]14; CHECK-NEXT: --> {0,+,1}<nuw><nsw><%outer> U: [0,-2147483648) S: [0,-2147483648) Exits: %outer_l LoopDispositions: { %outer: Computable, %inner: Invariant }15; CHECK-NEXT: %o_idx.inc = add nsw i32 %o_idx, 116; CHECK-NEXT: --> {1,+,1}<nuw><%outer> U: [1,0) S: [1,0) Exits: (1 + %outer_l) LoopDispositions: { %outer: Computable, %inner: Invariant }17; CHECK-NEXT: %i_idx = phi i32 [ 0, %outer ], [ %i_idx.inc, %inner ]18; CHECK-NEXT: --> {0,+,1}<nuw><nsw><%inner> U: [0,-2147483648) S: [0,-2147483648) Exits: %inner_l LoopDispositions: { %inner: Computable, %outer: Variant }19; CHECK-NEXT: %i_idx.inc = add nsw i32 %i_idx, 120; CHECK-NEXT: --> {1,+,1}<nuw><%inner> U: [1,0) S: [1,0) Exits: (1 + %inner_l) LoopDispositions: { %inner: Computable, %outer: Variant }21; CHECK-NEXT: %v = sub nsw i32 %i_idx, %o_idx.inc22; CHECK-NEXT: --> {{\{\{}}-1,+,-1}<nw><%outer>,+,1}<nsw><%inner> U: full-set S: full-set Exits: {(-1 + %inner_l),+,-1}<nw><%outer> LoopDispositions: { %inner: Computable, %outer: Variant }23; CHECK-NEXT: %forub = udiv i32 1, %v24; CHECK-NEXT: --> (1 /u {{\{\{}}-1,+,-1}<nw><%outer>,+,1}<nsw><%inner>) U: [0,2) S: [0,2) Exits: (1 /u {(-1 + %inner_l),+,-1}<nw><%outer>) LoopDispositions: { %inner: Computable, %outer: Variant }25; CHECK-NEXT: Determining loop execution counts for: @subrecurrences26; CHECK-NEXT: Loop %inner: backedge-taken count is %inner_l27; CHECK-NEXT: Loop %inner: constant max backedge-taken count is i32 -128; CHECK-NEXT: Loop %inner: symbolic max backedge-taken count is %inner_l29; CHECK-NEXT: Loop %inner: Trip multiple is 130; CHECK-NEXT: Loop %outer: backedge-taken count is %outer_l31; CHECK-NEXT: Loop %outer: constant max backedge-taken count is i32 -132; CHECK-NEXT: Loop %outer: symbolic max backedge-taken count is %outer_l33; CHECK-NEXT: Loop %outer: Trip multiple is 134;35entry:36 br label %outer37 38outer:39 %o_idx = phi i32 [ 0, %entry ], [ %o_idx.inc, %outer.be ]40 %o_idx.inc = add nsw i32 %o_idx, 141 %cond = icmp eq i32 %o_idx, %val42 br i1 %cond, label %inner, label %outer.be43 44inner:45 %i_idx = phi i32 [ 0, %outer ], [ %i_idx.inc, %inner ]46 %i_idx.inc = add nsw i32 %i_idx, 147 %v = sub nsw i32 %i_idx, %o_idx.inc48 %forub = udiv i32 1, %v49 %cond2 = icmp eq i32 %i_idx, %inner_l50 br i1 %cond2, label %outer.be, label %inner51 52outer.be:53 %cond3 = icmp eq i32 %o_idx, %outer_l54 br i1 %cond3, label %exit, label %outer55 56exit:57 ret void58}59