[llvm] 2501ab5 - [ConstraintElim] Add test subtracting SIGNED_MIN.
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 5 08:32:59 PST 2022
Author: Florian Hahn
Date: 2022-12-05T16:32:45Z
New Revision: 2501ab5e3fbaebcc7742557d09551eed506c4dd0
URL: https://github.com/llvm/llvm-project/commit/2501ab5e3fbaebcc7742557d09551eed506c4dd0
DIFF: https://github.com/llvm/llvm-project/commit/2501ab5e3fbaebcc7742557d09551eed506c4dd0.diff
LOG: [ConstraintElim] Add test subtracting SIGNED_MIN.
Added:
Modified:
llvm/test/Transforms/ConstraintElimination/sub-nuw.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/ConstraintElimination/sub-nuw.ll b/llvm/test/Transforms/ConstraintElimination/sub-nuw.ll
index 0af257e3cb5c..3a9c04939307 100644
--- a/llvm/test/Transforms/ConstraintElimination/sub-nuw.ll
+++ b/llvm/test/Transforms/ConstraintElimination/sub-nuw.ll
@@ -370,3 +370,29 @@ define i1 @wrapping_offset_sum(i64 %x) {
%ult = icmp ugt i64 200, %add
ret i1 %ult
}
+
+define i1 @sub_nuw_i64_signed_min(i64 %a) {
+; CHECK-LABEL: @sub_nuw_i64_signed_min(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[SUB:%.*]] = sub nuw i64 [[A:%.*]], -9223372036854775808
+; CHECK-NEXT: [[C_1:%.*]] = icmp ugt i64 [[A]], [[SUB]]
+; CHECK-NEXT: ret i1 [[C_1]]
+;
+entry:
+ %sub = sub nuw i64 %a, -9223372036854775808
+ %c.1 = icmp ugt i64 %a, %sub
+ ret i1 %c.1
+}
+
+define i1 @sub_nuw_i64_signed_min_const(i64 %a) {
+; CHECK-LABEL: @sub_nuw_i64_signed_min_const(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[NEG2:%.*]] = sub nuw i64 0, -9223372036854775808
+; CHECK-NEXT: [[C:%.*]] = icmp ugt i64 [[NEG2]], 0
+; CHECK-NEXT: ret i1 [[C]]
+;
+entry:
+ %neg2 = sub nuw i64 0, -9223372036854775808
+ %c = icmp ugt i64 %neg2, 0
+ ret i1 %c
+}
More information about the llvm-commits
mailing list