[PATCH] D25913: [InstCombine] Fold nuw left-shifts in `ugt`/`ule` comparisons.

bryant via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 25 16:42:44 PDT 2016


bryant added inline comments.


================
Comment at: lib/Transforms/InstCombine/InstCombineCompares.cpp:1962-1963
+    if (C->ugt(0) && Pred == ICmpInst::ICMP_ULT)
+      return new ICmpInst(ICmpInst::ICMP_ULE, X,
+                          ConstantInt::get(CTy, (*C - 1).lshr(*ShiftAmt)));
+    else if (Pred == ICmpInst::ICMP_UGT)
----------------
spatel wrote:
> Why return a ULE icmp here rather than ULT?
Are you suggesting to emit `x u< [(c - 1) >> s] - 1`? That just seems messier.


Repository:
  rL LLVM

https://reviews.llvm.org/D25913





More information about the llvm-commits mailing list