[llvm] 96c1fa2 - [SCEV] Add loop-guard pessimizing test with step = 2.
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Wed May 12 11:35:05 PDT 2021
Author: Florian Hahn
Date: 2021-05-12T19:30:11+01:00
New Revision: 96c1fa2a041d352d2b6eb202f3c419323239514f
URL: https://github.com/llvm/llvm-project/commit/96c1fa2a041d352d2b6eb202f3c419323239514f
DIFF: https://github.com/llvm/llvm-project/commit/96c1fa2a041d352d2b6eb202f3c419323239514f.diff
LOG: [SCEV] Add loop-guard pessimizing test with step = 2.
Added:
Modified:
llvm/test/Analysis/ScalarEvolution/max-backedge-taken-count-guard-info.ll
Removed:
################################################################################
diff --git a/llvm/test/Analysis/ScalarEvolution/max-backedge-taken-count-guard-info.ll b/llvm/test/Analysis/ScalarEvolution/max-backedge-taken-count-guard-info.ll
index 09aa75e9cb5d5..3123811a132eb 100644
--- a/llvm/test/Analysis/ScalarEvolution/max-backedge-taken-count-guard-info.ll
+++ b/llvm/test/Analysis/ScalarEvolution/max-backedge-taken-count-guard-info.ll
@@ -823,9 +823,9 @@ exit:
; Function Attrs: nounwind willreturn
declare void @llvm.assume(i1 noundef)
-define void @guard_pessimizes_analysis(i1 %c, i32 %N) {
-; CHECK-LABEL: 'guard_pessimizes_analysis'
-; CHECK-NEXT: Classifying expressions for: @guard_pessimizes_analysis
+define void @guard_pessimizes_analysis_step1(i1 %c, i32 %N) {
+; CHECK-LABEL: 'guard_pessimizes_analysis_step1'
+; CHECK-NEXT: Classifying expressions for: @guard_pessimizes_analysis_step1
; CHECK-NEXT: %init = phi i32 [ 2, %entry ], [ 3, %bb1 ]
; CHECK-NEXT: --> %init U: [2,4) S: [2,4)
; CHECK-NEXT: %iv = phi i32 [ %iv.next, %loop ], [ %init, %loop.ph ]
@@ -863,6 +863,43 @@ exit:
ret void
}
+define void @guard_pessimizes_analysis_step2(i1 %c, i32 %N) {
+; CHECK-LABEL: guard_pessimizes_analysis_step2
+; CHECK-NEXT: Classifying expressions for: @guard_pessimizes_analysis_step2
+; CHECK-NEXT: %init = phi i32 [ 2, %entry ], [ 3, %bb1 ]
+; CHECK-NEXT: --> %init U: [2,4) S: [2,4)
+; CHECK-NEXT: %iv = phi i32 [ %iv.next, %loop ], [ %init, %loop.ph ]
+; CHECK-NEXT: --> {%init,+,2}<nuw><nsw><%loop> U: [2,10) S: [2,10) Exits: ((2 * ((8 + (-1 * %init)<nsw>)<nsw> /u 2))<nuw><nsw> + %init) LoopDispositions: { %loop: Computable }
+; CHECK-NEXT: %iv.next = add nuw nsw i32 %iv, 2
+ ; CHECK-NEXT: --> {(2 + %init)<nuw><nsw>,+,2}<nuw><nsw><%loop> U: [4,12) S: [4,12) Exits: (2 + (2 * ((8 + (-1 * %init)<nsw>)<nsw> /u 2))<nuw><nsw> + %init) LoopDispositions: { %loop: Computable }
+; CHECK-NEXT: Determining loop execution counts for: @guard_pessimizes_analysis_step2
+; CHECK-NEXT: Loop %loop: backedge-taken count is ((8 + (-1 * %init)<nsw>)<nsw> /u 2)
+; CHECK-NEXT: Loop %loop: max backedge-taken count is 3
+; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((8 + (-1 * %init)<nsw>)<nsw> /u 2)
+; CHECK: Loop %loop: Trip multiple is 1
+entry:
+ br i1 %c, label %bb1, label %guard
+
+bb1:
+ br label %guard
+
+guard:
+ %init = phi i32 [ 2, %entry ], [ 3, %bb1 ]
+ %c.1 = icmp ult i32 %init, %N
+ br i1 %c.1, label %loop.ph, label %exit
+
+loop.ph:
+ br label %loop
+
+loop:
+ %iv = phi i32 [ %iv.next, %loop ], [ %init, %loop.ph ]
+ %iv.next = add nuw nsw i32 %iv, 2
+ %exitcond = icmp eq i32 %iv.next, 10
+ br i1 %exitcond, label %exit, label %loop
+
+exit:
+ ret void
+}
define void @crash(i8* %ptr) {
; CHECK-LABEL: 'crash'
; CHECK-NEXT: Classifying expressions for: @crash
More information about the llvm-commits
mailing list