[PATCH] D152677: [InstCombine] If there is a known-bit transform is_pow2 check to just check for any other bits

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 18 08:06:59 PDT 2023


nikic accepted this revision.
nikic added a comment.
This revision is now accepted and ready to land.

LGTM, but the attached proof is for the wrong transform.



================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp:3424
+    Value *Op = CtpopLhs->getArgOperand(0);
+    KnownBits OpKnown = llvm::computeKnownBits(Op, Q.DL,
+                                               /*Depth*/ 0, Q.AC, Q.CxtI, Q.DT);
----------------
Unnecessary llvm prefix.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp:3429
+      Value *And = Builder.CreateAnd(
+          Op, Constant::getIntegerValue(Op->getType(), ~(OpKnown.One)));
+      return new ICmpInst(
----------------



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D152677



More information about the llvm-commits mailing list