[PATCH] D143373: [InstCombine] fold icmp of the sum of ext bool based on limited range

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 6 13:45:16 PST 2023


spatel added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp:5849
+        return BinaryOperator::CreateAnd(Builder.CreateNot(X), Y);
+      if (Pred == ICmpInst::ICMP_NE || Pred == ICmpInst::ICMP_SGT)
+        return BinaryOperator::CreateOr(X, Builder.CreateNot(Y));
----------------
goldstein.w.n wrote:
> spatel wrote:
> > Include "ULT" here?
> > Include "ULT" here?
> 
> All corresponding unsigned predicts no?
We could, but it would probably just be dead code.

UGT: "x u> -1" is really "x u> 0xffff..." (is always simplified to false).
SLT: handled by SCCP, but nothing in instcombine gets it, so we should add that to the list too.

All of ULE/UGE/SLE/SGE will be canonicalized to their LT/GT counterparts, so we don't need to handle those.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D143373/new/

https://reviews.llvm.org/D143373



More information about the llvm-commits mailing list