[PATCH] D153148: [InstCombine] Fold `(-1 + zext(B)) & X` into `B ? 0 : X` where B is effectively a bool

Noah Goldstein via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 16 13:29:49 PDT 2023


goldstein.w.n added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp:2577
+      (A->getType()->isIntOrIntVectorTy(1) ||
+       (~computeKnownBits(A, 0, dyn_cast<Instruction>(Op1)).Zero) == 1))
+    return SelectInst::Create(
----------------
goldstein.w.n wrote:
> goldstein.w.n wrote:
> > Comment that 0 refers to depth.
> Dont cast op1 cxti, make a simplifyquery at `I` (sorry not computer at the moment, so can't lookup exact syntax)
I think using knownbits:::ule(1) would ne a lot clearer.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D153148



More information about the llvm-commits mailing list