[PATCH] D157309: [ValueTracking] Do more thorough non-zero check in `isKnownToBePowerOfTwo` when `OrZero` is no set.

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 9 04:06:27 PDT 2023


nikic added a comment.

Please land the remainder of the patch stack first.



================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:2049
   case Instruction::Shl:
-    if (OrZero || Q.IIQ.hasNoUnsignedWrap(I) || Q.IIQ.hasNoSignedWrap(I))
-      return isKnownToBeAPowerOfTwo(I->getOperand(0), OrZero, Depth, Q);
----------------
Would it make sense to preserve the flag checks? I think isKnownNonZero will be able to prove the same result, but in a more roundabout way (it can't just check the flags, it will also have to prove non-zero operands etc).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D157309



More information about the llvm-commits mailing list