[PATCH] D140851: [Patch 3/4]: Add cases for assume (X & Y != {0|Y})
Noah Goldstein via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 4 10:10:53 PST 2023
goldstein.w.n added inline comments.
================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:939
+ // 1. is_pow2(b) && b == a
+ // v.zeros[log2(b)] = 1
+ // 2. is_pow2(b) && 0 == a
----------------
nikic wrote:
> goldstein.w.n wrote:
> > nikic wrote:
> > > It looks like we are missing this canonicalization: https://alive2.llvm.org/ce/z/MtveLU With that done, this becomes `v & b == 0` and is covered by existing handling.
> > > It looks like we are missing this canonicalization: https://alive2.llvm.org/ce/z/MtveLU With that done, this becomes `v & b == 0` and is covered by existing handling.
> >
> > So would a better approach be to handle the `v & b != a` canonicalization in `InstCombine` and drop this case or leave this as is?
> Handling this in InstCombine would be preferred, it reduces the number of patterns other passes see.
> Handling this in InstCombine would be preferred, it reduces the number of patterns other passes see.
Do you know where I should look in `InstCombineCompares` for where to put this?
================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:950
+ KnownBits AKnown = computeKnownBits(A, Depth + 1, QueryNoAC)
+ .anyextOrTrunc(BitWidth);
+ if (AKnown.isZero()) {
----------------
nikic wrote:
> This should just check whether A is zero, no need to compute known bits.
> This should just check whether A is zero, no need to compute known bits.
How can I check if a value is known zero w.o `computeKnownBits`? I see `isKnownNonZero` but not the inverse.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D140851/new/
https://reviews.llvm.org/D140851
More information about the llvm-commits
mailing list