[NFC][InstCombine] Add test coverage for PR47997

This commit is contained in:
Roman Lebedev 2020-11-03 13:18:20 +03:00
parent d68bed0fa9
commit 482d65331b
No known key found for this signature in database
GPG Key ID: 083C3EBB4A1689E0
1 changed files with 23 additions and 0 deletions
llvm/test/Transforms/InstCombine

View File

@ -3821,3 +3821,26 @@ define i1 @signbit_bitcast_fptrunc_ppc_fp128(ppc_fp128 %x) {
%s4 = icmp slt i32 %s3, 0
ret i1 %s4
}
@x = external dso_local local_unnamed_addr global i32, align 4
@y = external dso_local local_unnamed_addr global i32, align 4
define i1 @pr47997(i32 %arg) {
; CHECK-LABEL: @pr47997(
; CHECK-NEXT: bb:
; CHECK-NEXT: [[I:%.*]] = add nsw i32 [[ARG:%.*]], -1
; CHECK-NEXT: store i32 [[I]], i32* @x, align 4
; CHECK-NEXT: [[I1:%.*]] = sub nsw i32 1, [[ARG]]
; CHECK-NEXT: store i32 [[I1]], i32* @y, align 4
; CHECK-NEXT: [[I2:%.*]] = sub nsw i32 0, [[I1]]
; CHECK-NEXT: [[I3:%.*]] = icmp eq i32 [[I]], [[I2]]
; CHECK-NEXT: ret i1 [[I3]]
;
bb:
%i = add nsw i32 %arg, -1
store i32 %i, i32* @x
%i1 = sub nsw i32 1, %arg
store i32 %i1, i32* @y
%i2 = sub nsw i32 0, %i1
%i3 = icmp eq i32 %i, %i2
ret i1 %i3
}