[llvm] 0bd9162 - [Test] Add test showing that SCEV cannot properly infer ranges of cycled phis

Max Kazantsev via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 27 01:11:58 PDT 2021


Author: Max Kazantsev
Date: 2021-09-27T15:01:43+07:00
New Revision: 0bd9162fd78da878f1cfd4b65c4f450c0c25fd47

URL: https://github.com/llvm/llvm-project/commit/0bd9162fd78da878f1cfd4b65c4f450c0c25fd47
DIFF: https://github.com/llvm/llvm-project/commit/0bd9162fd78da878f1cfd4b65c4f450c0c25fd47.diff

LOG: [Test] Add test showing that SCEV cannot properly infer ranges of cycled phis

Added: 
    llvm/test/Analysis/ScalarEvolution/cycled_phis.ll

Modified: 
    

Removed: 
    


################################################################################
diff  --git a/llvm/test/Analysis/ScalarEvolution/cycled_phis.ll b/llvm/test/Analysis/ScalarEvolution/cycled_phis.ll
new file mode 100644
index 000000000000..d8f748bd5b48
--- /dev/null
+++ b/llvm/test/Analysis/ScalarEvolution/cycled_phis.ll
@@ -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
+}


        


More information about the llvm-commits mailing list