[llvm] r279257 - [InstCombine] add missing tests for basic icmp folds

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 19 08:21:45 PDT 2016


Author: spatel
Date: Fri Aug 19 10:21:45 2016
New Revision: 279257

URL: http://llvm.org/viewvc/llvm-project?rev=279257&view=rev
Log:
[InstCombine] add missing tests for basic icmp folds

These are implicitly included as part of larger test cases, but they don't 
exist stand-alone (and don't happen for vectors...).

Modified:
    llvm/trunk/test/Transforms/InstCombine/icmp.ll

Modified: llvm/trunk/test/Transforms/InstCombine/icmp.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/icmp.ll?rev=279257&r1=279256&r2=279257&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/icmp.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/icmp.ll Fri Aug 19 10:21:45 2016
@@ -2581,3 +2581,22 @@ define i1 @PR27792_2(i128 %a) {
   ret i1 %b
 }
 
+define i1 @ugtMaxSignedVal(i8 %a) {
+; CHECK-LABEL: @ugtMaxSignedVal(
+; CHECK-NEXT:    [[CMP:%.*]] = icmp slt i8 %a, 0
+; CHECK-NEXT:    ret i1 [[CMP]]
+;
+  %cmp = icmp ugt i8 %a, 127
+  ret i1 %cmp
+}
+
+define i1 @ugtKnownBits(i8 %a) {
+; CHECK-LABEL: @ugtKnownBits(
+; CHECK-NEXT:    [[B:%.*]] = and i8 %a, 17
+; CHECK-NEXT:    [[CMP:%.*]] = icmp eq i8 [[B]], 17
+; CHECK-NEXT:    ret i1 [[CMP]]
+;
+  %b = and i8 %a, 17
+  %cmp = icmp ugt i8 %b, 16
+  ret i1 %cmp
+}




More information about the llvm-commits mailing list