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

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 25 14:49:31 PDT 2016


spatel 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)
----------------
Why return a ULE icmp here rather than ULT?


Repository:
  rL LLVM

https://reviews.llvm.org/D25913





More information about the llvm-commits mailing list