Skip to content

Commit

Permalink
[Test] Add test showing that SCEV cannot properly infer ranges of cyc…
Browse files Browse the repository at this point in the history
…led phis
  • Loading branch information
xortator committed Sep 27, 2021
1 parent 92b475f commit 0bd9162
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions llvm/test/Analysis/ScalarEvolution/cycled_phis.ll
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
; RUN: opt < %s -disable-output "-passes=print<scalar-evolution>" 2>&1 | FileCheck %s

declare i1 @cond()

; FIXME: Range of phi_1 and phi_2 here can be sharpened to [10, 21).
define void @test_01() {
; CHECK-LABEL: 'test_01'
; CHECK-NEXT: Classifying expressions for: @test_01
; CHECK-NEXT: %phi_1 = phi i32 [ 10, %entry ], [ %phi_2, %loop ]
; CHECK-NEXT: --> %phi_1 U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
; CHECK-NEXT: %phi_2 = phi i32 [ 20, %entry ], [ %phi_1, %loop ]
; CHECK-NEXT: --> %phi_2 U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
; CHECK-NEXT: %cond = call i1 @cond()
; CHECK-NEXT: --> %cond U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
; CHECK-NEXT: Determining loop execution counts for: @test_01
; CHECK-NEXT: Loop %loop: Unpredictable backedge-taken count.
; CHECK-NEXT: Loop %loop: Unpredictable max backedge-taken count.
; CHECK-NEXT: Loop %loop: Unpredictable predicated backedge-taken count.
;
entry:
br label %loop

loop:
%phi_1 = phi i32 [ 10, %entry], [%phi_2, %loop]
%phi_2 = phi i32 [ 20, %entry], [%phi_1, %loop]
%cond = call i1 @cond()
br i1 %cond, label %loop, label %exit

exit:
ret void
}

0 comments on commit 0bd9162

Please sign in to comment.