[llvm] f085b7c - [SCEV] Add additional tests where the max BTC is limited by wrapping.
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 16 12:36:22 PDT 2020
Author: Florian Hahn
Date: 2020-10-16T20:36:02+01:00
New Revision: f085b7cbc1a673e89f74926961e44ba468411619
URL: https://github.com/llvm/llvm-project/commit/f085b7cbc1a673e89f74926961e44ba468411619
DIFF: https://github.com/llvm/llvm-project/commit/f085b7cbc1a673e89f74926961e44ba468411619.diff
LOG: [SCEV] Add additional tests where the max BTC is limited by wrapping.
Added:
Modified:
llvm/test/Analysis/ScalarEvolution/max-backedge-taken-count-limit-by-wrapping.ll
Removed:
################################################################################
diff --git a/llvm/test/Analysis/ScalarEvolution/max-backedge-taken-count-limit-by-wrapping.ll b/llvm/test/Analysis/ScalarEvolution/max-backedge-taken-count-limit-by-wrapping.ll
index 976c7d32eacb..63bd29bc81b0 100644
--- a/llvm/test/Analysis/ScalarEvolution/max-backedge-taken-count-limit-by-wrapping.ll
+++ b/llvm/test/Analysis/ScalarEvolution/max-backedge-taken-count-limit-by-wrapping.ll
@@ -4,8 +4,8 @@
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
-define void @max_backedge_taken_count_by_wrapping1(i8 %N, i8* %ptr) {
-; CHECK-LABEL: Determining loop execution counts for: @max_backedge_taken_count_by_wrapping1
+define void @max_backedge_taken_count_by_wrapping1_nsw_nuw(i8 %N, i8* %ptr) {
+; CHECK-LABEL: Determining loop execution counts for: @max_backedge_taken_count_by_wrapping1_nsw_nuw
; CHECK-NEXT: Loop %loop: backedge-taken count is (%N /u 4)
; CHECK-NEXT: Loop %loop: max backedge-taken count is 63
; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (%N /u 4)
@@ -25,18 +25,38 @@ exit:
ret void
}
-; TODO: Max backedge taken count could be improved.
-define void @max_backedge_taken_count_by_wrapping2(i8 %N, i8* %ptr) {
+define void @max_backedge_taken_count_by_wrapping1_nuw(i8 %N, i8* %ptr) {
+; CHECK-LABEL: Determining loop execution counts for: @max_backedge_taken_count_by_wrapping1_nuw
+; CHECK-NEXT: Loop %loop: backedge-taken count is (%N /u 4)
+; CHECK-NEXT: Loop %loop: max backedge-taken count is 63
+; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (%N /u 4)
+;
+entry:
+ br label %loop
+
+loop:
+ %iv = phi i8 [ 0, %entry ], [ %iv.next, %loop ]
+ %gep = getelementptr i8, i8* %ptr, i8 %iv
+ store i8 %iv, i8* %gep
+ %iv.next = add nuw i8 %iv, 4
+ %ec = icmp ne i8 %iv, %N
+ br i1 %ec, label %loop, label %exit
+
+exit:
+ ret void
+}
+
+define void @max_backedge_taken_count_by_wrapping2_nsw_nuw(i8 %N, i8* %ptr) {
; CHECK-LABEL: Determining loop execution counts for: @max_backedge_taken_count_by_wrapping2
-; CHECK-NEXT: Loop %loop: backedge-taken count is ((-128 + %N) /u 4)
+; CHECK-NEXT: Loop %loop: backedge-taken count is ((-64 + %N) /u 4)
; CHECK-NEXT: Loop %loop: max backedge-taken count is 63
-; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((-128 + %N) /u 4)
+; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((-64 + %N) /u 4)
;
entry:
br label %loop
loop:
- %iv = phi i8 [ 128, %entry ], [ %iv.next, %loop ]
+ %iv = phi i8 [ 64, %entry ], [ %iv.next, %loop ]
%gep = getelementptr i8, i8* %ptr, i8 %iv
store i8 %iv, i8* %gep
%iv.next = add nuw nsw i8 %iv, 4
@@ -46,3 +66,24 @@ loop:
exit:
ret void
}
+
+define void @max_backedge_taken_count_by_wrapping2_nuw(i8 %N, i8* %ptr) {
+; CHECK-LABEL: Determining loop execution counts for: @max_backedge_taken_count_by_wrapping2
+; CHECK-NEXT: Loop %loop: backedge-taken count is ((-64 + %N) /u 4)
+; CHECK-NEXT: Loop %loop: max backedge-taken count is 63
+; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((-64 + %N) /u 4)
+;
+entry:
+ br label %loop
+
+loop:
+ %iv = phi i8 [ 64, %entry ], [ %iv.next, %loop ]
+ %gep = getelementptr i8, i8* %ptr, i8 %iv
+ store i8 %iv, i8* %gep
+ %iv.next = add nuw i8 %iv, 4
+ %ec = icmp ne i8 %iv, %N
+ br i1 %ec, label %loop, label %exit
+
+exit:
+ ret void
+}
More information about the llvm-commits
mailing list