[llvm] b155c87 - [InstCombine] add tests for icmp with constant offset and no-wrap flags; NFC
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 14 09:12:13 PDT 2021
Author: Sanjay Patel
Date: 2021-07-14T12:12:05-04:00
New Revision: b155c871f2e21beed45d15a25f7c84fb4f0c1d93
URL: https://github.com/llvm/llvm-project/commit/b155c871f2e21beed45d15a25f7c84fb4f0c1d93
DIFF: https://github.com/llvm/llvm-project/commit/b155c871f2e21beed45d15a25f7c84fb4f0c1d93.diff
LOG: [InstCombine] add tests for icmp with constant offset and no-wrap flags; NFC
Added:
Modified:
llvm/test/Transforms/InstCombine/icmp-add.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/InstCombine/icmp-add.ll b/llvm/test/Transforms/InstCombine/icmp-add.ll
index aa69325d716c..3a9880697b21 100644
--- a/llvm/test/Transforms/InstCombine/icmp-add.ll
+++ b/llvm/test/Transforms/InstCombine/icmp-add.ll
@@ -794,6 +794,16 @@ define i1 @ugt_wrong_offset(i8 %a) {
ret i1 %ov
}
+define i1 @ugt_offset_nuw(i8 %a) {
+; CHECK-LABEL: @ugt_offset_nuw(
+; CHECK-NEXT: [[OV:%.*]] = icmp slt i8 [[A:%.*]], -124
+; CHECK-NEXT: ret i1 [[OV]]
+;
+ %t = add nuw i8 %a, 124
+ %ov = icmp ugt i8 %t, 251
+ ret i1 %ov
+}
+
define i1 @ult_offset(i8 %a) {
; CHECK-LABEL: @ult_offset(
; CHECK-NEXT: [[OV:%.*]] = icmp sgt i8 [[A:%.*]], 5
@@ -840,6 +850,16 @@ define i1 @ult_wrong_offset(i8 %a) {
ret i1 %ov
}
+define i1 @ult_offset_nuw(i8 %a) {
+; CHECK-LABEL: @ult_offset_nuw(
+; CHECK-NEXT: [[OV:%.*]] = icmp sgt i8 [[A:%.*]], -43
+; CHECK-NEXT: ret i1 [[OV]]
+;
+ %t = add nuw i8 %a, 42
+ %ov = icmp ult i8 %t, 170
+ ret i1 %ov
+}
+
define i1 @sgt_offset(i8 %a) {
; CHECK-LABEL: @sgt_offset(
; CHECK-NEXT: [[OV:%.*]] = icmp ult i8 [[A:%.*]], -122
@@ -886,6 +906,16 @@ define i1 @sgt_wrong_offset(i8 %a) {
ret i1 %ov
}
+define i1 @sgt_offset_nsw(i8 %a, i8 %c) {
+; CHECK-LABEL: @sgt_offset_nsw(
+; CHECK-NEXT: [[OV:%.*]] = icmp ult i8 [[A:%.*]], 86
+; CHECK-NEXT: ret i1 [[OV]]
+;
+ %t = add nsw i8 %a, 42
+ %ov = icmp sgt i8 %t, 41
+ ret i1 %ov
+}
+
define i1 @slt_offset(i8 %a) {
; CHECK-LABEL: @slt_offset(
; CHECK-NEXT: [[OV:%.*]] = icmp ugt i8 [[A:%.*]], -123
@@ -931,3 +961,13 @@ define i1 @slt_wrong_offset(i8 %a) {
%ov = icmp slt i8 %t, -7
ret i1 %ov
}
+
+define i1 @slt_offset_nsw(i8 %a, i8 %c) {
+; CHECK-LABEL: @slt_offset_nsw(
+; CHECK-NEXT: [[OV:%.*]] = icmp slt i8 [[A:%.*]], 0
+; CHECK-NEXT: ret i1 [[OV]]
+;
+ %t = add nsw i8 %a, 42
+ %ov = icmp slt i8 %t, 42
+ ret i1 %ov
+}
More information about the llvm-commits
mailing list