[llvm] 2d6aff8 - One more test case inspired by PR50191
Philip Reames via llvm-commits
llvm-commits at lists.llvm.org
Mon May 3 16:23:09 PDT 2021
Author: Philip Reames
Date: 2021-05-03T16:23:04-07:00
New Revision: 2d6aff84c9d7ab7babec3511197337467e3b3082
URL: https://github.com/llvm/llvm-project/commit/2d6aff84c9d7ab7babec3511197337467e3b3082
DIFF: https://github.com/llvm/llvm-project/commit/2d6aff84c9d7ab7babec3511197337467e3b3082.diff
LOG: One more test case inspired by PR50191
Added:
Modified:
llvm/test/Analysis/ValueTracking/known-non-equal.ll
Removed:
################################################################################
diff --git a/llvm/test/Analysis/ValueTracking/known-non-equal.ll b/llvm/test/Analysis/ValueTracking/known-non-equal.ll
index 915ecf7f549d..c1a8f07953a3 100644
--- a/llvm/test/Analysis/ValueTracking/known-non-equal.ll
+++ b/llvm/test/Analysis/ValueTracking/known-non-equal.ll
@@ -1715,6 +1715,7 @@ exit:
ret i1 %res
}
+
define i1 @mutual_recurrence_neq(i8 %A) {
; CHECK-LABEL: @mutual_recurrence_neq(
; CHECK-NEXT: entry:
@@ -1779,5 +1780,42 @@ exit:
ret i1 %res
}
+; Illustrate a case where A_IV_i == B_IV_i for all i > 0, but A_IV_0 != B_IV_0.
+; (E.g. This pair of mutually defined recurrences are not invertible.)
+define i1 @recurrence_collapse(i8 %A) {
+; CHECK-LABEL: @recurrence_collapse(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[B:%.*]] = add i8 [[A:%.*]], 1
+; CHECK-NEXT: br label [[LOOP:%.*]]
+; CHECK: loop:
+; CHECK-NEXT: [[IV:%.*]] = phi i64 [ 0, [[ENTRY:%.*]] ], [ [[IV_NEXT:%.*]], [[LOOP]] ]
+; CHECK-NEXT: [[A_IV:%.*]] = phi i8 [ [[A]], [[ENTRY]] ], [ [[A_IV_NEXT:%.*]], [[LOOP]] ]
+; CHECK-NEXT: [[B_IV:%.*]] = phi i8 [ [[B]], [[ENTRY]] ], [ [[B_IV_NEXT:%.*]], [[LOOP]] ]
+; CHECK-NEXT: [[IV_NEXT]] = add i64 [[IV]], 1
+; CHECK-NEXT: [[A_IV_NEXT]] = sub i8 [[A_IV]], [[B_IV]]
+; CHECK-NEXT: [[B_IV_NEXT]] = sub i8 [[A_IV]], [[B_IV]]
+; CHECK-NEXT: [[CMP:%.*]] = icmp ne i64 [[IV_NEXT]], 10
+; CHECK-NEXT: br i1 [[CMP]], label [[LOOP]], label [[EXIT:%.*]]
+; CHECK: exit:
+; CHECK-NEXT: [[RES:%.*]] = icmp eq i8 [[A_IV]], [[B_IV]]
+; CHECK-NEXT: ret i1 [[RES]]
+;
+entry:
+ %B = add i8 %A, 1
+ br label %loop
+loop:
+ %iv = phi i64 [0, %entry], [%iv.next, %loop]
+ %A.iv = phi i8 [%A, %entry], [%A.iv.next, %loop]
+ %B.iv = phi i8 [%B, %entry], [%B.iv.next, %loop]
+ %iv.next = add i64 %iv, 1
+ %A.iv.next = sub i8 %A.iv, %B.iv
+ %B.iv.next = sub i8 %A.iv, %B.iv
+ %cmp = icmp ne i64 %iv.next, 10
+ br i1 %cmp, label %loop, label %exit
+exit:
+ %res = icmp eq i8 %A.iv, %B.iv
+ ret i1 %res
+}
+
!0 = !{ i8 1, i8 5 }
More information about the llvm-commits
mailing list