[CVP] Add test for PR50399 (NFC)

This commit is contained in:
Nikita Popov 2021-05-22 11:21:02 +02:00
parent 8ed0864fd7
commit 069174a634
1 changed files with 39 additions and 4 deletions

View File

@ -10,7 +10,7 @@ define i8* @simplify_phi_common_value_op0(i8* %ptr, i32* %b) {
; CHECK: else:
; CHECK-NEXT: [[LB:%.*]] = load i32, i32* [[B:%.*]], align 4
; CHECK-NEXT: [[ADD:%.*]] = add nsw i32 [[LB]], 1
; CHECK-NEXT: store i32 [[ADD]], i32* [[B]]
; CHECK-NEXT: store i32 [[ADD]], i32* [[B]], align 4
; CHECK-NEXT: br label [[RETURN]]
; CHECK: return:
; CHECK-NEXT: ret i8* [[PTR]]
@ -38,7 +38,7 @@ define i8* @simplify_phi_common_value_op1(i8* %ptr, i32* %b) {
; CHECK: else:
; CHECK-NEXT: [[LB:%.*]] = load i32, i32* [[B:%.*]], align 4
; CHECK-NEXT: [[ADD:%.*]] = add i32 [[LB]], 1
; CHECK-NEXT: store i32 [[ADD]], i32* [[B]]
; CHECK-NEXT: store i32 [[ADD]], i32* [[B]], align 4
; CHECK-NEXT: br label [[RETURN]]
; CHECK: return:
; CHECK-NEXT: ret i8* [[PTR]]
@ -69,7 +69,7 @@ define i8 @simplify_phi_multiple_constants(i8 %x, i32* %b) {
; CHECK: else2:
; CHECK-NEXT: [[LB:%.*]] = load i32, i32* [[B:%.*]], align 4
; CHECK-NEXT: [[ADD:%.*]] = add i32 [[LB]], 1
; CHECK-NEXT: store i32 [[ADD]], i32* [[B]]
; CHECK-NEXT: store i32 [[ADD]], i32* [[B]], align 4
; CHECK-NEXT: br label [[RETURN]]
; CHECK: return:
; CHECK-NEXT: ret i8 [[X]]
@ -102,7 +102,7 @@ define i8* @simplify_phi_common_value_from_instruction(i8* %ptr_op, i32* %b, i32
; CHECK: else:
; CHECK-NEXT: [[LB:%.*]] = load i32, i32* [[B:%.*]], align 4
; CHECK-NEXT: [[ADD:%.*]] = add nsw i32 [[LB]], 1
; CHECK-NEXT: store i32 [[ADD]], i32* [[B]]
; CHECK-NEXT: store i32 [[ADD]], i32* [[B]], align 4
; CHECK-NEXT: br label [[RETURN]]
; CHECK: return:
; CHECK-NEXT: ret i8* [[PTR]]
@ -149,3 +149,38 @@ bb3:
%r = phi i32 [ -2147483648, %bb2 ], [ %sub, %entry ]
ret i32 %r
}
; TODO: Miscompile.
define i8 @pr50399(i8 %x) {
; CHECK-LABEL: @pr50399(
; CHECK-NEXT: [[CMP:%.*]] = icmp slt i8 [[X:%.*]], -100
; CHECK-NEXT: [[Y:%.*]] = add i8 [[X]], -100
; CHECK-NEXT: br i1 [[CMP]], label [[JOIN1:%.*]], label [[ELSE:%.*]]
; CHECK: else:
; CHECK-NEXT: [[CMP2:%.*]] = icmp eq i8 [[Y]], 0
; CHECK-NEXT: br i1 [[CMP2]], label [[JOIN1]], label [[ELSE2:%.*]]
; CHECK: join1:
; CHECK-NEXT: br label [[JOIN2:%.*]]
; CHECK: else2:
; CHECK-NEXT: br label [[JOIN2]]
; CHECK: join2:
; CHECK-NEXT: ret i8 [[Y]]
;
%cmp = icmp slt i8 %x, -100
%y = add nsw i8 %x, -100
br i1 %cmp, label %join1, label %else
else: ; preds = %cond.end9
%cmp2 = icmp eq i8 %y, 0
br i1 %cmp2, label %join1, label %else2
join1:
br label %join2
else2: ; preds = %bb
br label %join2
join2:
%phi = phi i8 [ 0, %join1 ], [ %y, %else2 ]
ret i8 %phi
}