1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00

One more test case inspired by PR50191

This commit is contained in:
Philip Reames 2021-05-03 16:22:56 -07:00
parent f5c6ef2e13
commit b123d90a62

View File

@ -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 }