[PATCH] D24700: [InstCombine] optimize unsigned icmp of increment

Matti Niemenmaa via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 26 12:54:53 PDT 2016


Deewiant added inline comments.

================
Comment at: test/Transforms/InstCombine/icmp.ll:2765
@@ +2764,3 @@
+
+define i1 @icmp_sub1_uge(i32 %x, i32 %y) {
+; CHECK-LABEL: @icmp_sub1_uge(
----------------
Added one for each combination of signed/unsigned, LHS/RHS, increment/decrement, for a total of eight.

================
Comment at: test/Transforms/InstCombine/icmp.ll:2799
@@ +2798,3 @@
+; CHECK-LABEL: @cmp_ult_rhs_inc(
+; CHECK-NEXT:    [[CONV:%.*]] = fptosi float %x to i32
+; CHECK-NEXT:    [[CMP:%.*]] = icmp ule i32 [[CONV]], %i
----------------
sanjoy wrote:
> I'd drop the `fptosi` unless you need it for some reason -- it is distracting.
I copied the idea from the tests for the `nsw` case further above (e.g. `cmp_sgt_rhs_dec`). I haven't actually looked into what exactly is happening here: without `fptosi` the comparisons get flipped so that the increment is on the LHS, which would make these tests equivalent to the earlier ones.


https://reviews.llvm.org/D24700





More information about the llvm-commits mailing list