[PATCH] D148321: [ConstraintElimination] Add tests to check for transfering facts from sgt to uge.
Zain Jaffal via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 14 04:10:31 PDT 2023
zjaffal updated this revision to Diff 513533.
zjaffal added a comment.
change back to ugt
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D148321/new/
https://reviews.llvm.org/D148321
Files:
llvm/test/Transforms/ConstraintElimination/transfer-signed-facts-to-unsigned.ll
Index: llvm/test/Transforms/ConstraintElimination/transfer-signed-facts-to-unsigned.ll
===================================================================
--- llvm/test/Transforms/ConstraintElimination/transfer-signed-facts-to-unsigned.ll
+++ llvm/test/Transforms/ConstraintElimination/transfer-signed-facts-to-unsigned.ll
@@ -596,6 +596,74 @@
ret i1 %res.2
}
+define i1 @sgt_to_ugt(i8 %a) {
+; CHECK-LABEL: @sgt_to_ugt(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[CMP:%.*]] = icmp sgt i8 [[A:%.*]], 2
+; CHECK-NEXT: call void @llvm.assume(i1 [[CMP]])
+; CHECK-NEXT: [[T_1:%.*]] = icmp ugt i8 [[A]], 2
+; CHECK-NEXT: ret i1 [[T_1]]
+;
+entry:
+ %cmp = icmp sgt i8 %a, 2
+ call void @llvm.assume(i1 %cmp)
+ %t.1 = icmp ugt i8 %a, 2
+ ret i1 %t.1
+}
+
+define i1 @sgt_to_ugt_var(i8 %a, i8 %b) {
+; CHECK-LABEL: @sgt_to_ugt_var(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[CMP:%.*]] = icmp sgt i8 [[A:%.*]], [[B:%.*]]
+; CHECK-NEXT: [[CMP_2:%.*]] = icmp sgt i8 [[B]], 0
+; CHECK-NEXT: call void @llvm.assume(i1 [[CMP]])
+; CHECK-NEXT: call void @llvm.assume(i1 [[CMP_2]])
+; CHECK-NEXT: [[T_1:%.*]] = icmp ugt i8 [[A]], [[B]]
+; CHECK-NEXT: ret i1 [[T_1]]
+;
+entry:
+ %cmp = icmp sgt i8 %a, %b
+ %cmp.2 = icmp sgt i8 %b, 0
+ call void @llvm.assume(i1 %cmp)
+ call void @llvm.assume(i1 %cmp.2)
+ %t.1 = icmp ugt i8 %a, %b
+ ret i1 %t.1
+}
+
+define i1 @sgt_to_ugt_not(i8 %a) {
+; CHECK-LABEL: @sgt_to_ugt_not(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[CMP:%.*]] = icmp sgt i8 [[A:%.*]], -1
+; CHECK-NEXT: call void @llvm.assume(i1 [[CMP]])
+; CHECK-NEXT: [[T_1:%.*]] = icmp ugt i8 [[A]], -1
+; CHECK-NEXT: ret i1 [[T_1]]
+;
+entry:
+ %cmp = icmp sgt i8 %a, -1
+ call void @llvm.assume(i1 %cmp)
+ %t.1 = icmp ugt i8 %a, -1
+ ret i1 %t.1
+}
+
+define i1 @sgt_to_ugt_var_not(i8 %a, i8 %b) {
+; CHECK-LABEL: @sgt_to_ugt_var_not(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[CMP:%.*]] = icmp sgt i8 [[A:%.*]], [[B:%.*]]
+; CHECK-NEXT: [[CMP_2:%.*]] = icmp sgt i8 [[B]], -2
+; CHECK-NEXT: call void @llvm.assume(i1 [[CMP]])
+; CHECK-NEXT: call void @llvm.assume(i1 [[CMP_2]])
+; CHECK-NEXT: [[T_1:%.*]] = icmp ugt i8 [[A]], [[B]]
+; CHECK-NEXT: ret i1 [[T_1]]
+;
+entry:
+ %cmp = icmp sgt i8 %a, %b
+ %cmp.2 = icmp sgt i8 %b, -2
+ call void @llvm.assume(i1 %cmp)
+ call void @llvm.assume(i1 %cmp.2)
+ %t.1 = icmp ugt i8 %a, %b
+ ret i1 %t.1
+}
+
define i1 @slt_first_op_known_pos(i8 %idx) {
; CHECK-LABEL: @slt_first_op_known_pos(
; CHECK-NEXT: entry:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D148321.513533.patch
Type: text/x-patch
Size: 2518 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230414/bc4d5dd9/attachment.bin>
More information about the llvm-commits
mailing list