Skip to content

Commit

Permalink
[Test] Add expensive-range-sharpening mode for test
Browse files Browse the repository at this point in the history
Looks like it can benefit from this mode.
  • Loading branch information
xortator committed Apr 6, 2023
1 parent eda14eb commit 63df77d
Showing 1 changed file with 53 additions and 26 deletions.
79 changes: 53 additions & 26 deletions llvm/test/Analysis/ScalarEvolution/decrementing_addrecs.ll
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --version 2
; RUN: opt -disable-output "-passes=print<scalar-evolution>" < %s 2>&1 | FileCheck %s
; RUN: opt -disable-output "-passes=print<scalar-evolution>" < %s 2>&1 | FileCheck %s --check-prefix=DEFAULT
; RUN: opt -disable-output "-passes=print<scalar-evolution>" -scalar-evolution-use-expensive-range-sharpening < %s 2>&1 | FileCheck %s --check-prefix=EXPENSIVE_SHARPENING

; This test exercises the following scenario:
; given: n > 0
Expand All @@ -26,31 +27,57 @@
; FIXME: b is expected to be non-negative
; c is expected to be positive
define i32 @test_step_1_flags(i32 %n) {
; CHECK-LABEL: 'test_step_1_flags'
; CHECK-NEXT: Classifying expressions for: @test_step_1_flags
; CHECK-NEXT: %n.minus.1 = sub nsw i32 %n, 1
; CHECK-NEXT: --> (-1 + %n) U: full-set S: full-set
; CHECK-NEXT: %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
; CHECK-NEXT: --> {0,+,1}<nuw><nsw><%loop> U: [0,2147483647) S: [0,2147483647) Exits: (-1 + %n) LoopDispositions: { %loop: Computable }
; CHECK-NEXT: %j = phi i32 [ %n.minus.1, %entry ], [ %j.next, %loop ]
; CHECK-NEXT: --> {(-1 + %n),+,-1}<nsw><%loop> U: full-set S: full-set Exits: 0 LoopDispositions: { %loop: Computable }
; CHECK-NEXT: %a = sub i32 %n, %i
; CHECK-NEXT: --> {%n,+,-1}<nw><%loop> U: full-set S: full-set Exits: 1 LoopDispositions: { %loop: Computable }
; CHECK-NEXT: %b = sub i32 %n.minus.1, %i
; CHECK-NEXT: --> {(-1 + %n),+,-1}<nsw><%loop> U: full-set S: full-set Exits: 0 LoopDispositions: { %loop: Computable }
; CHECK-NEXT: %c = sub i32 2147483647, %i
; CHECK-NEXT: --> {2147483647,+,-1}<nw><%loop> U: [1,-2147483648) S: [1,-2147483648) Exits: (-2147483648 + (-1 * %n)) LoopDispositions: { %loop: Computable }
; CHECK-NEXT: %i.next = add nuw nsw i32 %i, 1
; CHECK-NEXT: --> {1,+,1}<nuw><nsw><%loop> U: [1,-2147483648) S: [1,-2147483648) Exits: %n LoopDispositions: { %loop: Computable }
; CHECK-NEXT: %j.next = add nsw i32 %j, -1
; CHECK-NEXT: --> {(-2 + %n),+,-1}<nw><%loop> U: full-set S: full-set Exits: -1 LoopDispositions: { %loop: Computable }
; CHECK-NEXT: Determining loop execution counts for: @test_step_1_flags
; CHECK-NEXT: Loop %loop: backedge-taken count is (-1 + %n)
; CHECK-NEXT: Loop %loop: constant max backedge-taken count is 2147483646
; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (-1 + %n)
; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-1 + %n)
; CHECK-NEXT: Predicates:
; CHECK: Loop %loop: Trip multiple is 1
; DEFAULT-LABEL: 'test_step_1_flags'
; DEFAULT-NEXT: Classifying expressions for: @test_step_1_flags
; DEFAULT-NEXT: %n.minus.1 = sub nsw i32 %n, 1
; DEFAULT-NEXT: --> (-1 + %n) U: full-set S: full-set
; DEFAULT-NEXT: %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
; DEFAULT-NEXT: --> {0,+,1}<nuw><nsw><%loop> U: [0,2147483647) S: [0,2147483647) Exits: (-1 + %n) LoopDispositions: { %loop: Computable }
; DEFAULT-NEXT: %j = phi i32 [ %n.minus.1, %entry ], [ %j.next, %loop ]
; DEFAULT-NEXT: --> {(-1 + %n),+,-1}<nsw><%loop> U: full-set S: full-set Exits: 0 LoopDispositions: { %loop: Computable }
; DEFAULT-NEXT: %a = sub i32 %n, %i
; DEFAULT-NEXT: --> {%n,+,-1}<nw><%loop> U: full-set S: full-set Exits: 1 LoopDispositions: { %loop: Computable }
; DEFAULT-NEXT: %b = sub i32 %n.minus.1, %i
; DEFAULT-NEXT: --> {(-1 + %n),+,-1}<nsw><%loop> U: full-set S: full-set Exits: 0 LoopDispositions: { %loop: Computable }
; DEFAULT-NEXT: %c = sub i32 2147483647, %i
; DEFAULT-NEXT: --> {2147483647,+,-1}<nw><%loop> U: [1,-2147483648) S: [1,-2147483648) Exits: (-2147483648 + (-1 * %n)) LoopDispositions: { %loop: Computable }
; DEFAULT-NEXT: %i.next = add nuw nsw i32 %i, 1
; DEFAULT-NEXT: --> {1,+,1}<nuw><nsw><%loop> U: [1,-2147483648) S: [1,-2147483648) Exits: %n LoopDispositions: { %loop: Computable }
; DEFAULT-NEXT: %j.next = add nsw i32 %j, -1
; DEFAULT-NEXT: --> {(-2 + %n),+,-1}<nw><%loop> U: full-set S: full-set Exits: -1 LoopDispositions: { %loop: Computable }
; DEFAULT-NEXT: Determining loop execution counts for: @test_step_1_flags
; DEFAULT-NEXT: Loop %loop: backedge-taken count is (-1 + %n)
; DEFAULT-NEXT: Loop %loop: constant max backedge-taken count is 2147483646
; DEFAULT-NEXT: Loop %loop: symbolic max backedge-taken count is (-1 + %n)
; DEFAULT-NEXT: Loop %loop: Predicated backedge-taken count is (-1 + %n)
; DEFAULT-NEXT: Predicates:
; DEFAULT: Loop %loop: Trip multiple is 1
;
; EXPENSIVE_SHARPENING-LABEL: 'test_step_1_flags'
; EXPENSIVE_SHARPENING-NEXT: Classifying expressions for: @test_step_1_flags
; EXPENSIVE_SHARPENING-NEXT: %n.minus.1 = sub nsw i32 %n, 1
; EXPENSIVE_SHARPENING-NEXT: --> (-1 + %n) U: full-set S: full-set
; EXPENSIVE_SHARPENING-NEXT: %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
; EXPENSIVE_SHARPENING-NEXT: --> {0,+,1}<nuw><nsw><%loop> U: [0,2147483647) S: [0,2147483647) Exits: (-1 + %n) LoopDispositions: { %loop: Computable }
; EXPENSIVE_SHARPENING-NEXT: %j = phi i32 [ %n.minus.1, %entry ], [ %j.next, %loop ]
; EXPENSIVE_SHARPENING-NEXT: --> {(-1 + %n),+,-1}<nsw><%loop> U: full-set S: full-set Exits: 0 LoopDispositions: { %loop: Computable }
; EXPENSIVE_SHARPENING-NEXT: %a = sub i32 %n, %i
; EXPENSIVE_SHARPENING-NEXT: --> {%n,+,-1}<nw><%loop> U: full-set S: full-set Exits: 1 LoopDispositions: { %loop: Computable }
; EXPENSIVE_SHARPENING-NEXT: %b = sub i32 %n.minus.1, %i
; EXPENSIVE_SHARPENING-NEXT: --> {(-1 + %n),+,-1}<nsw><%loop> U: full-set S: full-set Exits: 0 LoopDispositions: { %loop: Computable }
; EXPENSIVE_SHARPENING-NEXT: %c = sub i32 2147483647, %i
; EXPENSIVE_SHARPENING-NEXT: --> {2147483647,+,-1}<nw><%loop> U: [1,-2147483648) S: [1,-2147483648) Exits: (-2147483648 + (-1 * %n)) LoopDispositions: { %loop: Computable }
; EXPENSIVE_SHARPENING-NEXT: %i.next = add nuw nsw i32 %i, 1
; EXPENSIVE_SHARPENING-NEXT: --> {1,+,1}<nuw><nsw><%loop> U: [1,-2147483648) S: [1,-2147483648) Exits: %n LoopDispositions: { %loop: Computable }
; EXPENSIVE_SHARPENING-NEXT: %j.next = add nsw i32 %j, -1
; EXPENSIVE_SHARPENING-NEXT: --> {(-2 + %n),+,-1}<nw><%loop> U: full-set S: full-set Exits: -1 LoopDispositions: { %loop: Computable }
; EXPENSIVE_SHARPENING-NEXT: Determining loop execution counts for: @test_step_1_flags
; EXPENSIVE_SHARPENING-NEXT: Loop %loop: backedge-taken count is (-1 + %n)
; EXPENSIVE_SHARPENING-NEXT: Loop %loop: constant max backedge-taken count is 2147483646
; EXPENSIVE_SHARPENING-NEXT: Loop %loop: symbolic max backedge-taken count is (-1 + %n)
; EXPENSIVE_SHARPENING-NEXT: Loop %loop: Predicated backedge-taken count is (-1 + %n)
; EXPENSIVE_SHARPENING-NEXT: Predicates:
; EXPENSIVE_SHARPENING: Loop %loop: Trip multiple is 1
;
entry:
%n.minus.1 = sub nsw i32 %n, 1
Expand Down

0 comments on commit 63df77d

Please sign in to comment.