[PATCH] D51040: [InstCombine] Add new tests for icmp ugt/ult (add nuw X, C2), C

Nicola Zaghen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 21 08:07:11 PDT 2018


Nicola created this revision.
Nicola added a reviewer: spatel.
Herald added a subscriber: llvm-commits.

The new tests will be improved after https://reviews.llvm.org/D50972


Repository:
  rL LLVM

https://reviews.llvm.org/D51040

Files:
  test/Transforms/InstCombine/icmp-add.ll


Index: test/Transforms/InstCombine/icmp-add.ll
===================================================================
--- test/Transforms/InstCombine/icmp-add.ll
+++ test/Transforms/InstCombine/icmp-add.ll
@@ -281,3 +281,46 @@
   ret i1 %z
 }
 
+define i1 @reduce_add_ult(i32 %in) {
+; CHECK-LABEL: @reduce_add_ult(
+; CHECK-NEXT:    [[A6:%.*]] = add nuw i32 [[IN:%.*]], 3
+; CHECK-NEXT:    [[A18:%.*]] = icmp ult i32 [[A6]], 12
+; CHECK-NEXT:    ret i1 [[A18]]
+;
+  %a6 = add nuw i32 %in, 3
+  %a18 = icmp ult i32 %a6, 12
+  ret i1 %a18
+}
+
+define i1 @reduce_add_ugt(i32 %in) {
+; CHECK-LABEL: @reduce_add_ugt(
+; CHECK-NEXT:    [[A6:%.*]] = add nuw i32 [[IN:%.*]], 3
+; CHECK-NEXT:    [[A18:%.*]] = icmp ugt i32 [[A6]], 12
+; CHECK-NEXT:    ret i1 [[A18]]
+;
+  %a6 = add nuw i32 %in, 3
+  %a18 = icmp ugt i32 %a6, 12
+  ret i1 %a18
+}
+
+define i1 @reduce_add_ule(i32 %in) {
+; CHECK-LABEL: @reduce_add_ule(
+; CHECK-NEXT:    [[A6:%.*]] = add nuw i32 [[IN:%.*]], 3
+; CHECK-NEXT:    [[A18:%.*]] = icmp ult i32 [[A6]], 13
+; CHECK-NEXT:    ret i1 [[A18]]
+;
+  %a6 = add nuw i32 %in, 3
+  %a18 = icmp ule i32 %a6, 12
+  ret i1 %a18
+}
+
+define i1 @reduce_add_uge(i32 %in) {
+; CHECK-LABEL: @reduce_add_uge(
+; CHECK-NEXT:    [[A6:%.*]] = add nuw i32 [[IN:%.*]], 3
+; CHECK-NEXT:    [[A18:%.*]] = icmp ugt i32 [[A6]], 11
+; CHECK-NEXT:    ret i1 [[A18]]
+;
+  %a6 = add nuw i32 %in, 3
+  %a18 = icmp uge i32 %a6, 12
+  ret i1 %a18
+}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51040.161726.patch
Type: text/x-patch
Size: 1436 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180821/4d91a8df/attachment.bin>


More information about the llvm-commits mailing list