diff --git a/llvm/test/Analysis/ScalarEvolution/flags-from-poison-noautogen.ll b/llvm/test/Analysis/ScalarEvolution/flags-from-poison-noautogen.ll new file mode 100644 index 000000000000..3e715f5656d3 --- /dev/null +++ b/llvm/test/Analysis/ScalarEvolution/flags-from-poison-noautogen.ll @@ -0,0 +1,61 @@ +; RUN: opt < %s -S -disable-output "-passes=print" 2>&1 | FileCheck %s + +; This file is conceptually part of flags-from-poison.ll except that the +; test does not successfully auto-update via utils/update_analysis_tests_checks.sh + +; Subtraction of two recurrences. The addition in the SCEV that this +; maps to is NSW, but the negation of the RHS does not since that +; recurrence could be the most negative representable value. +define void @subrecurrences(i32 %outer_l, i32 %inner_l, i32 %val) { +; CHECK-LABEL: 'subrecurrences' +; CHECK-NEXT: Classifying expressions for: @subrecurrences +; CHECK-NEXT: %o_idx = phi i32 [ 0, %entry ], [ %o_idx.inc, %outer.be ] +; CHECK-NEXT: --> {0,+,1}<%outer> U: [0,-2147483648) S: [0,-2147483648) Exits: %outer_l LoopDispositions: { %outer: Computable, %inner: Invariant } +; CHECK-NEXT: %o_idx.inc = add nsw i32 %o_idx, 1 +; CHECK-NEXT: --> {1,+,1}<%outer> U: [1,0) S: [1,0) Exits: (1 + %outer_l) LoopDispositions: { %outer: Computable, %inner: Invariant } +; CHECK-NEXT: %i_idx = phi i32 [ 0, %outer ], [ %i_idx.inc, %inner ] +; CHECK-NEXT: --> {0,+,1}<%inner> U: [0,-2147483648) S: [0,-2147483648) Exits: %inner_l LoopDispositions: { %inner: Computable, %outer: Variant } +; CHECK-NEXT: %i_idx.inc = add nsw i32 %i_idx, 1 +; CHECK-NEXT: --> {1,+,1}<%inner> U: [1,0) S: [1,0) Exits: (1 + %inner_l) LoopDispositions: { %inner: Computable, %outer: Variant } +; CHECK-NEXT: %v = sub nsw i32 %i_idx, %o_idx.inc +; CHECK-NEXT: --> +; NOTE: Line deleted from autogen output due to format confusing regex matcher +; CHECK-NEXT: %forub = udiv i32 1, %v +; CHECK-NEXT: --> +; NOTE: Line deleted from autogen output due to format confusing regex matcher +; CHECK-NEXT: Determining loop execution counts for: @subrecurrences +; CHECK-NEXT: Loop %inner: backedge-taken count is %inner_l +; CHECK-NEXT: Loop %inner: max backedge-taken count is -1 +; CHECK-NEXT: Loop %inner: Predicated backedge-taken count is %inner_l +; CHECK-NEXT: Predicates: +; CHECK: Loop %inner: Trip multiple is 1 +; CHECK-NEXT: Loop %outer: backedge-taken count is %outer_l +; CHECK-NEXT: Loop %outer: max backedge-taken count is -1 +; CHECK-NEXT: Loop %outer: Predicated backedge-taken count is %outer_l +; CHECK-NEXT: Predicates: +; CHECK: Loop %outer: Trip multiple is 1 +; +entry: + br label %outer + +outer: + %o_idx = phi i32 [ 0, %entry ], [ %o_idx.inc, %outer.be ] + %o_idx.inc = add nsw i32 %o_idx, 1 + %cond = icmp eq i32 %o_idx, %val + br i1 %cond, label %inner, label %outer.be + +inner: + %i_idx = phi i32 [ 0, %outer ], [ %i_idx.inc, %inner ] + %i_idx.inc = add nsw i32 %i_idx, 1 + %v = sub nsw i32 %i_idx, %o_idx.inc + %forub = udiv i32 1, %v + %cond2 = icmp eq i32 %i_idx, %inner_l + br i1 %cond2, label %outer.be, label %inner + +outer.be: + %cond3 = icmp eq i32 %o_idx, %outer_l + br i1 %cond3, label %exit, label %outer + +exit: + ret void +} diff --git a/llvm/test/Analysis/ScalarEvolution/flags-from-poison.ll b/llvm/test/Analysis/ScalarEvolution/flags-from-poison.ll index 3a04bd49536f..7aa2002c736f 100644 --- a/llvm/test/Analysis/ScalarEvolution/flags-from-poison.ll +++ b/llvm/test/Analysis/ScalarEvolution/flags-from-poison.ll @@ -1336,65 +1336,6 @@ exit: ret void } - -; Subtraction of two recurrences. The addition in the SCEV that this -; maps to is NSW, but the negation of the RHS does not since that -; recurrence could be the most negative representable value. -define void @subrecurrences(i32 %outer_l, i32 %inner_l, i32 %val) { -; CHECK-LABEL: 'subrecurrences' -; CHECK-NEXT: Classifying expressions for: @subrecurrences -; CHECK-NEXT: %o_idx = phi i32 [ 0, %entry ], [ %o_idx.inc, %outer.be ] -; CHECK-NEXT: --> {0,+,1}<%outer> U: [0,-2147483648) S: [0,-2147483648) Exits: %outer_l LoopDispositions: { %outer: Computable, %inner: Invariant } -; CHECK-NEXT: %o_idx.inc = add nsw i32 %o_idx, 1 -; CHECK-NEXT: --> {1,+,1}<%outer> U: [1,0) S: [1,0) Exits: (1 + %outer_l) LoopDispositions: { %outer: Computable, %inner: Invariant } -; CHECK-NEXT: %i_idx = phi i32 [ 0, %outer ], [ %i_idx.inc, %inner ] -; CHECK-NEXT: --> {0,+,1}<%inner> U: [0,-2147483648) S: [0,-2147483648) Exits: %inner_l LoopDispositions: { %inner: Computable, %outer: Variant } -; CHECK-NEXT: %i_idx.inc = add nsw i32 %i_idx, 1 -; CHECK-NEXT: --> {1,+,1}<%inner> U: [1,0) S: [1,0) Exits: (1 + %inner_l) LoopDispositions: { %inner: Computable, %outer: Variant } -; CHECK-NEXT: %v = sub nsw i32 %i_idx, %o_idx.inc -; CHECK-NEXT: --> -; NOTE: Line deleted from autogen output due to format confusing regex matcher -; CHECK-NEXT: %forub = udiv i32 1, %v -; CHECK-NEXT: --> -; NOTE: Line deleted from autogen output due to format confusing regex matcher -; CHECK-NEXT: Determining loop execution counts for: @subrecurrences -; CHECK-NEXT: Loop %inner: backedge-taken count is %inner_l -; CHECK-NEXT: Loop %inner: max backedge-taken count is -1 -; CHECK-NEXT: Loop %inner: Predicated backedge-taken count is %inner_l -; CHECK-NEXT: Predicates: -; CHECK: Loop %inner: Trip multiple is 1 -; CHECK-NEXT: Loop %outer: backedge-taken count is %outer_l -; CHECK-NEXT: Loop %outer: max backedge-taken count is -1 -; CHECK-NEXT: Loop %outer: Predicated backedge-taken count is %outer_l -; CHECK-NEXT: Predicates: -; CHECK: Loop %outer: Trip multiple is 1 -; -entry: - br label %outer - -outer: - %o_idx = phi i32 [ 0, %entry ], [ %o_idx.inc, %outer.be ] - %o_idx.inc = add nsw i32 %o_idx, 1 - %cond = icmp eq i32 %o_idx, %val - br i1 %cond, label %inner, label %outer.be - -inner: - %i_idx = phi i32 [ 0, %outer ], [ %i_idx.inc, %inner ] - %i_idx.inc = add nsw i32 %i_idx, 1 - %v = sub nsw i32 %i_idx, %o_idx.inc - %forub = udiv i32 1, %v - %cond2 = icmp eq i32 %i_idx, %inner_l - br i1 %cond2, label %outer.be, label %inner - -outer.be: - %cond3 = icmp eq i32 %o_idx, %outer_l - br i1 %cond3, label %exit, label %outer - -exit: - ret void -} - - ; PR28932: Don't assert on non-SCEV-able value %2. %struct.anon = type { i8* } @a = common global %struct.anon* null, align 8