[llvm] 069174a - [CVP] Add test for PR50399 (NFC)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Sat May 22 02:44:35 PDT 2021
Author: Nikita Popov
Date: 2021-05-22T11:21:34+02:00
New Revision: 069174a6349b18a05b7d48b09a8f8b113b402aae
URL: https://github.com/llvm/llvm-project/commit/069174a6349b18a05b7d48b09a8f8b113b402aae
DIFF: https://github.com/llvm/llvm-project/commit/069174a6349b18a05b7d48b09a8f8b113b402aae.diff
LOG: [CVP] Add test for PR50399 (NFC)
Added:
Modified:
llvm/test/Transforms/CorrelatedValuePropagation/phi-common-val.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/CorrelatedValuePropagation/phi-common-val.ll b/llvm/test/Transforms/CorrelatedValuePropagation/phi-common-val.ll
index 058a33684cc7f..0668de0d8acbe 100644
--- a/llvm/test/Transforms/CorrelatedValuePropagation/phi-common-val.ll
+++ b/llvm/test/Transforms/CorrelatedValuePropagation/phi-common-val.ll
@@ -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
+}
More information about the llvm-commits
mailing list