-
Notifications
You must be signed in to change notification settings - Fork 13.4k
[ConstraintElim] Add noundef
to several testcases (NFC)
#135799
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
@llvm/pr-subscribers-llvm-transforms Author: Iris (el-ev) Changes[ConstraintElim] Add update check Full diff: https://github.com/llvm/llvm-project/pull/135799.diff 2 Files Affected:
diff --git a/llvm/test/Transforms/ConstraintElimination/abs.ll b/llvm/test/Transforms/ConstraintElimination/abs.ll
index a49b4643ab92c..f1291e41f13b2 100644
--- a/llvm/test/Transforms/ConstraintElimination/abs.ll
+++ b/llvm/test/Transforms/ConstraintElimination/abs.ll
@@ -1,12 +1,11 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
; RUN: opt -passes=constraint-elimination -S %s | FileCheck %s
-define i1 @abs_int_min_is_not_poison(i32 %arg) {
+define i1 @abs_int_min_is_not_poison(i32 noundef %arg) {
; CHECK-LABEL: define i1 @abs_int_min_is_not_poison(
-; CHECK-SAME: i32 [[ARG:%.*]]) {
+; CHECK-SAME: i32 noundef [[ARG:%.*]]) {
; CHECK-NEXT: [[ABS:%.*]] = tail call i32 @llvm.abs.i32(i32 [[ARG]], i1 false)
-; CHECK-NEXT: [[CMP:%.*]] = icmp sge i32 [[ABS]], [[ARG]]
-; CHECK-NEXT: ret i1 [[CMP]]
+; CHECK-NEXT: ret i1 true
;
%abs = tail call i32 @llvm.abs.i32(i32 %arg, i1 false)
%cmp = icmp sge i32 %abs, %arg
@@ -25,8 +24,21 @@ define i1 @abs_int_min_is_poison(i32 %arg) {
ret i1 %cmp
}
-define i1 @abs_plus_one(i32 %arg) {
-; CHECK-LABEL: define i1 @abs_plus_one(
+define i1 @abs_plus_one_min_is_not_poison(i32 noundef %arg) {
+; CHECK-LABEL: define i1 @abs_plus_one_min_is_not_poison(
+; CHECK-SAME: i32 noundef [[ARG:%.*]]) {
+; CHECK-NEXT: [[ABS:%.*]] = tail call i32 @llvm.abs.i32(i32 [[ARG]], i1 false)
+; CHECK-NEXT: [[ABS_PLUS_ONE:%.*]] = add nsw i32 [[ABS]], 1
+; CHECK-NEXT: ret i1 true
+;
+ %abs = tail call i32 @llvm.abs.i32(i32 %arg, i1 false)
+ %abs_plus_one = add nsw i32 %abs, 1
+ %cmp = icmp sge i32 %abs_plus_one, %arg
+ ret i1 %cmp
+}
+
+define i1 @abs_plus_one_min_is_poison(i32 %arg) {
+; CHECK-LABEL: define i1 @abs_plus_one_min_is_poison(
; CHECK-SAME: i32 [[ARG:%.*]]) {
; CHECK-NEXT: [[ABS:%.*]] = tail call i32 @llvm.abs.i32(i32 [[ARG]], i1 true)
; CHECK-NEXT: [[ABS_PLUS_ONE:%.*]] = add nsw i32 [[ABS]], 1
@@ -39,8 +51,22 @@ define i1 @abs_plus_one(i32 %arg) {
ret i1 %cmp
}
-define i1 @arg_minus_one_strict_less(i32 %arg) {
-; CHECK-LABEL: define i1 @arg_minus_one_strict_less(
+define i1 @arg_minus_one_strict_less_min_is_not_poison(i32 noundef %arg) {
+; CHECK-LABEL: define i1 @arg_minus_one_strict_less_min_is_not_poison(
+; CHECK-SAME: i32 noundef [[ARG:%.*]]) {
+; CHECK-NEXT: [[ABS:%.*]] = tail call i32 @llvm.abs.i32(i32 [[ARG]], i1 false)
+; CHECK-NEXT: [[ARG_MINUS_ONE:%.*]] = add nsw i32 [[ARG]], -1
+; CHECK-NEXT: ret i1 true
+;
+ %abs = tail call i32 @llvm.abs.i32(i32 %arg, i1 false)
+ %arg_minus_one = add nsw i32 %arg, -1
+ %cmp = icmp slt i32 %arg_minus_one, %abs
+ ret i1 %cmp
+}
+
+
+define i1 @arg_minus_one_strict_less_min_is_poison(i32 %arg) {
+; CHECK-LABEL: define i1 @arg_minus_one_strict_less_min_is_poison(
; CHECK-SAME: i32 [[ARG:%.*]]) {
; CHECK-NEXT: [[ABS:%.*]] = tail call i32 @llvm.abs.i32(i32 [[ARG]], i1 true)
; CHECK-NEXT: [[ARG_MINUS_ONE:%.*]] = add nsw i32 [[ARG]], -1
@@ -53,8 +79,21 @@ define i1 @arg_minus_one_strict_less(i32 %arg) {
ret i1 %cmp
}
-define i1 @arg_minus_one_strict_greater(i32 %arg) {
-; CHECK-LABEL: define i1 @arg_minus_one_strict_greater(
+define i1 @arg_minus_one_strict_greater_min_is_not_poison(i32 noundef %arg) {
+; CHECK-LABEL: define i1 @arg_minus_one_strict_greater_min_is_not_poison(
+; CHECK-SAME: i32 noundef [[ARG:%.*]]) {
+; CHECK-NEXT: [[ABS:%.*]] = tail call i32 @llvm.abs.i32(i32 [[ARG]], i1 false)
+; CHECK-NEXT: [[ARG_MINUS_ONE:%.*]] = add nsw i32 [[ARG]], -1
+; CHECK-NEXT: ret i1 false
+;
+ %abs = tail call i32 @llvm.abs.i32(i32 %arg, i1 false)
+ %arg_minus_one = add nsw i32 %arg, -1
+ %cmp = icmp sgt i32 %arg_minus_one, %abs
+ ret i1 %cmp
+}
+
+define i1 @arg_minus_one_strict_greater_min_is_poison(i32 %arg) {
+; CHECK-LABEL: define i1 @arg_minus_one_strict_greater_min_is_poison(
; CHECK-SAME: i32 [[ARG:%.*]]) {
; CHECK-NEXT: [[ABS:%.*]] = tail call i32 @llvm.abs.i32(i32 [[ARG]], i1 true)
; CHECK-NEXT: [[ARG_MINUS_ONE:%.*]] = add nsw i32 [[ARG]], -1
@@ -67,8 +106,24 @@ define i1 @arg_minus_one_strict_greater(i32 %arg) {
ret i1 %cmp
}
-define i1 @abs_plus_one_unsigned_greater_or_equal_nonnegative_arg(i32 %arg) {
-; CHECK-LABEL: define i1 @abs_plus_one_unsigned_greater_or_equal_nonnegative_arg(
+define i1 @abs_plus_one_unsigned_greater_or_equal_nonnegative_arg_min_is_not_poison(i32 noundef %arg) {
+; CHECK-LABEL: define i1 @abs_plus_one_unsigned_greater_or_equal_nonnegative_arg_min_is_not_poison(
+; CHECK-SAME: i32 noundef [[ARG:%.*]]) {
+; CHECK-NEXT: [[CMP_ARG_NONNEGATIVE:%.*]] = icmp sge i32 [[ARG]], 0
+; CHECK-NEXT: call void @llvm.assume(i1 [[CMP_ARG_NONNEGATIVE]])
+; CHECK-NEXT: [[ABS_PLUS_ONE:%.*]] = add nuw i32 [[ARG]], 1
+; CHECK-NEXT: ret i1 true
+;
+ %cmp_arg_nonnegative = icmp sge i32 %arg, 0
+ call void @llvm.assume(i1 %cmp_arg_nonnegative)
+ %abs = tail call i32 @llvm.abs.i32(i32 %arg, i1 false)
+ %abs_plus_one = add nuw i32 %abs, 1
+ %cmp = icmp uge i32 %abs_plus_one, %arg
+ ret i1 %cmp
+}
+
+define i1 @abs_plus_one_unsigned_greater_or_equal_nonnegative_arg_min_is_poison(i32 %arg) {
+; CHECK-LABEL: define i1 @abs_plus_one_unsigned_greater_or_equal_nonnegative_arg_min_is_poison(
; CHECK-SAME: i32 [[ARG:%.*]]) {
; CHECK-NEXT: [[CMP_ARG_NONNEGATIVE:%.*]] = icmp sge i32 [[ARG]], 0
; CHECK-NEXT: call void @llvm.assume(i1 [[CMP_ARG_NONNEGATIVE]])
@@ -83,15 +138,15 @@ define i1 @abs_plus_one_unsigned_greater_or_equal_nonnegative_arg(i32 %arg) {
ret i1 %cmp
}
-define i1 @abs_plus_one_unsigned_greater_or_equal_cannot_be_simplified(i32 %arg) {
+define i1 @abs_plus_one_unsigned_greater_or_equal_cannot_be_simplified(i32 noundef %arg) {
; CHECK-LABEL: define i1 @abs_plus_one_unsigned_greater_or_equal_cannot_be_simplified(
-; CHECK-SAME: i32 [[ARG:%.*]]) {
-; CHECK-NEXT: [[ABS:%.*]] = tail call i32 @llvm.abs.i32(i32 [[ARG]], i1 true)
+; CHECK-SAME: i32 noundef [[ARG:%.*]]) {
+; CHECK-NEXT: [[ABS:%.*]] = tail call i32 @llvm.abs.i32(i32 [[ARG]], i1 false)
; CHECK-NEXT: [[ABS_PLUS_ONE:%.*]] = add nuw i32 [[ABS]], 1
; CHECK-NEXT: [[CMP:%.*]] = icmp uge i32 [[ABS_PLUS_ONE]], [[ARG]]
; CHECK-NEXT: ret i1 [[CMP]]
;
- %abs = tail call i32 @llvm.abs.i32(i32 %arg, i1 true)
+ %abs = tail call i32 @llvm.abs.i32(i32 %arg, i1 false)
%abs_plus_one = add nuw i32 %abs, 1
%cmp = icmp uge i32 %abs_plus_one, %arg
ret i1 %cmp
@@ -127,18 +182,30 @@ define i1 @abs_is_nonnegative_except_for_int_min_if_int_min_is_not_poison(i32 %a
ret i1 %cmp
}
-define i1 @abs_is_not_strictly_positive(i32 %arg) {
+define i1 @abs_is_not_strictly_positive(i32 noundef %arg) {
; CHECK-LABEL: define i1 @abs_is_not_strictly_positive(
-; CHECK-SAME: i32 [[ARG:%.*]]) {
-; CHECK-NEXT: [[ABS:%.*]] = tail call i32 @llvm.abs.i32(i32 [[ARG]], i1 true)
+; CHECK-SAME: i32 noundef [[ARG:%.*]]) {
+; CHECK-NEXT: [[ABS:%.*]] = tail call i32 @llvm.abs.i32(i32 [[ARG]], i1 false)
; CHECK-NEXT: [[CMP:%.*]] = icmp sgt i32 [[ABS]], 0
; CHECK-NEXT: ret i1 [[CMP]]
;
- %abs = tail call i32 @llvm.abs.i32(i32 %arg, i1 true)
+ %abs = tail call i32 @llvm.abs.i32(i32 %arg, i1 false)
%cmp = icmp sgt i32 %abs, 0
ret i1 %cmp
}
+define i1 @abs_is_nonnegative_int_min_is_not_poison(i32 noundef %arg) {
+; CHECK-LABEL: define i1 @abs_is_nonnegative_int_min_is_not_poison(
+; CHECK-SAME: i32 noundef [[ARG:%.*]]) {
+; CHECK-NEXT: [[ABS:%.*]] = tail call i32 @llvm.abs.i32(i32 [[ARG]], i1 false)
+; CHECK-NEXT: [[CMP:%.*]] = icmp sge i32 [[ABS]], 0
+; CHECK-NEXT: ret i1 [[CMP]]
+;
+ %abs = tail call i32 @llvm.abs.i32(i32 %arg, i1 false)
+ %cmp = icmp sge i32 %abs, 0
+ ret i1 %cmp
+}
+
define i1 @abs_is_nonnegative_int_min_is_poison(i32 %arg) {
; CHECK-LABEL: define i1 @abs_is_nonnegative_int_min_is_poison(
; CHECK-SAME: i32 [[ARG:%.*]]) {
@@ -160,9 +227,9 @@ define i1 @abs_is_nonnegative_constant_arg() {
ret i1 %cmp
}
-define i64 @abs_assume_nonnegative(i64 %arg) {
+define i64 @abs_assume_nonnegative(i64 noundef %arg) {
; CHECK-LABEL: define i64 @abs_assume_nonnegative(
-; CHECK-SAME: i64 [[ARG:%.*]]) {
+; CHECK-SAME: i64 noundef [[ARG:%.*]]) {
; CHECK-NEXT: [[PRECOND:%.*]] = icmp sge i64 [[ARG]], 0
; CHECK-NEXT: call void @llvm.assume(i1 [[PRECOND]])
; CHECK-NEXT: ret i64 [[ARG]]
@@ -173,9 +240,9 @@ define i64 @abs_assume_nonnegative(i64 %arg) {
ret i64 %abs
}
-define i64 @abs_assume_negative(i64 %arg) {
+define i64 @abs_assume_negative(i64 noundef %arg) {
; CHECK-LABEL: define i64 @abs_assume_negative(
-; CHECK-SAME: i64 [[ARG:%.*]]) {
+; CHECK-SAME: i64 noundef [[ARG:%.*]]) {
; CHECK-NEXT: [[PRECOND:%.*]] = icmp slt i64 [[ARG]], 0
; CHECK-NEXT: call void @llvm.assume(i1 [[PRECOND]])
; CHECK-NEXT: [[ABS:%.*]] = sub i64 0, [[ARG]]
@@ -188,9 +255,9 @@ define i64 @abs_assume_negative(i64 %arg) {
}
; Negative test
-define i64 @abs_assume_unrelated(i64 %arg) {
+define i64 @abs_assume_unrelated(i64 noundef %arg) {
; CHECK-LABEL: define i64 @abs_assume_unrelated(
-; CHECK-SAME: i64 [[ARG:%.*]]) {
+; CHECK-SAME: i64 noundef [[ARG:%.*]]) {
; CHECK-NEXT: [[PRECOND:%.*]] = icmp slt i64 [[ARG]], 3
; CHECK-NEXT: call void @llvm.assume(i1 [[PRECOND]])
; CHECK-NEXT: [[ABS:%.*]] = tail call i64 @llvm.abs.i64(i64 [[ARG]], i1 false)
diff --git a/llvm/test/Transforms/ConstraintElimination/uadd-usub-sat.ll b/llvm/test/Transforms/ConstraintElimination/uadd-usub-sat.ll
index 567b5ce6c3a3f..f4dd79d9f33ec 100644
--- a/llvm/test/Transforms/ConstraintElimination/uadd-usub-sat.ll
+++ b/llvm/test/Transforms/ConstraintElimination/uadd-usub-sat.ll
@@ -4,9 +4,9 @@
declare i64 @llvm.uadd.sat.i64(i64, i64)
declare i64 @llvm.usub.sat.i64(i64, i64)
-define i1 @uadd_sat_uge(i64 %a, i64 %b) {
+define i1 @uadd_sat_uge(i64 noundef %a, i64 noundef %b) {
; CHECK-LABEL: define i1 @uadd_sat_uge(
-; CHECK-SAME: i64 [[A:%.*]], i64 [[B:%.*]]) {
+; CHECK-SAME: i64 noundef [[A:%.*]], i64 noundef [[B:%.*]]) {
; CHECK-NEXT: [[ADD_SAT:%.*]] = call i64 @llvm.uadd.sat.i64(i64 [[A]], i64 [[B]])
; CHECK-NEXT: [[CMP:%.*]] = and i1 true, true
; CHECK-NEXT: ret i1 [[CMP]]
@@ -18,21 +18,20 @@ define i1 @uadd_sat_uge(i64 %a, i64 %b) {
ret i1 %cmp
}
-define i1 @usub_sat_ule_lhs(i64 %a, i64 %b) {
+define i1 @usub_sat_ule_lhs(i64 noundef %a, i64 noundef %b) {
; CHECK-LABEL: define i1 @usub_sat_ule_lhs(
-; CHECK-SAME: i64 [[A:%.*]], i64 [[B:%.*]]) {
+; CHECK-SAME: i64 noundef [[A:%.*]], i64 noundef [[B:%.*]]) {
; CHECK-NEXT: [[SUB_SAT:%.*]] = call i64 @llvm.usub.sat.i64(i64 [[A]], i64 [[B]])
-; CHECK-NEXT: [[CMP:%.*]] = icmp ule i64 [[SUB_SAT]], [[A]]
-; CHECK-NEXT: ret i1 [[CMP]]
+; CHECK-NEXT: ret i1 true
;
%sub.sat = call i64 @llvm.usub.sat.i64(i64 %a, i64 %b)
%cmp = icmp ule i64 %sub.sat, %a
ret i1 %cmp
}
-define i64 @usub_sat_when_lhs_ugt_rhs(i64 %a, i64 %b) {
+define i64 @usub_sat_when_lhs_ugt_rhs(i64 noundef %a, i64 noundef %b) {
; CHECK-LABEL: define i64 @usub_sat_when_lhs_ugt_rhs(
-; CHECK-SAME: i64 [[A:%.*]], i64 [[B:%.*]]) {
+; CHECK-SAME: i64 noundef [[A:%.*]], i64 noundef [[B:%.*]]) {
; CHECK-NEXT: [[PRECOND:%.*]] = icmp ugt i64 [[A]], [[B]]
; CHECK-NEXT: call void @llvm.assume(i1 [[PRECOND]])
; CHECK-NEXT: [[SUB_SAT:%.*]] = sub i64 [[A]], [[B]]
@@ -44,9 +43,9 @@ define i64 @usub_sat_when_lhs_ugt_rhs(i64 %a, i64 %b) {
ret i64 %sub.sat
}
-define i64 @usub_sat_when_lhs_ule_rhs(i64 %a, i64 %b) {
+define i64 @usub_sat_when_lhs_ule_rhs(i64 noundef %a, i64 noundef %b) {
; CHECK-LABEL: define i64 @usub_sat_when_lhs_ule_rhs(
-; CHECK-SAME: i64 [[A:%.*]], i64 [[B:%.*]]) {
+; CHECK-SAME: i64 noundef [[A:%.*]], i64 noundef [[B:%.*]]) {
; CHECK-NEXT: [[PRECOND:%.*]] = icmp ule i64 [[A]], [[B]]
; CHECK-NEXT: call void @llvm.assume(i1 [[PRECOND]])
; CHECK-NEXT: ret i64 0
@@ -58,9 +57,9 @@ define i64 @usub_sat_when_lhs_ule_rhs(i64 %a, i64 %b) {
}
; Negative test
-define i1 @usub_sat_not_ule_rhs(i64 %a, i64 %b) {
+define i1 @usub_sat_not_ule_rhs(i64 noundef %a, i64 noundef %b) {
; CHECK-LABEL: define i1 @usub_sat_not_ule_rhs(
-; CHECK-SAME: i64 [[A:%.*]], i64 [[B:%.*]]) {
+; CHECK-SAME: i64 noundef [[A:%.*]], i64 noundef [[B:%.*]]) {
; CHECK-NEXT: [[SUB_SAT:%.*]] = call i64 @llvm.usub.sat.i64(i64 [[A]], i64 [[B]])
; CHECK-NEXT: [[CMP:%.*]] = icmp ule i64 [[SUB_SAT]], [[B]]
; CHECK-NEXT: ret i1 [[CMP]]
@@ -70,9 +69,9 @@ define i1 @usub_sat_not_ule_rhs(i64 %a, i64 %b) {
ret i1 %cmp
}
-define i64 @usub_sat_without_precond(i64 %a, i64 %b) {
+define i64 @usub_sat_without_precond(i64 noundef %a, i64 noundef %b) {
; CHECK-LABEL: define i64 @usub_sat_without_precond(
-; CHECK-SAME: i64 [[A:%.*]], i64 [[B:%.*]]) {
+; CHECK-SAME: i64 noundef [[A:%.*]], i64 noundef [[B:%.*]]) {
; CHECK-NEXT: [[SUB_SAT:%.*]] = call i64 @llvm.usub.sat.i64(i64 [[A]], i64 [[B]])
; CHECK-NEXT: ret i64 [[SUB_SAT]]
;
|
7db345b
to
a95ab65
Compare
f051f42
to
1c0a426
Compare
1c0a426
to
157aa8a
Compare
a95ab65
to
6ce5114
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just checking why this was closed?
The changes are moved to #136291. |
[ConstraintElim] Add
noundef
to several testcases (NFC)update check