[PATCH] D53036: [InstCombine] Demand bits of UMin
Sanjay Patel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 10 14:39:13 PDT 2018
spatel accepted this revision.
spatel added a comment.
LGTM - see inline for a couple of nits.
================
Comment at: lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp:330-332
+ // The lowest non-zero bit of DemandMask is higher than the highest
+ // non-one bit of C
+ // This comes about from some maths on the above umax example
----------------
Period at end of each sentence. Rather than random math, note this as the DeMorgan'd version of the umax logic.
================
Comment at: lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp:335
+ if (match(RHS, m_APInt(C)) &&
+ DemandedMask.countTrailingZeros() >=
+ C->getBitWidth() - C->countLeadingOnes())
----------------
Might read easier and fit better in 80-cols if we give the CTZ a name and use it here and for umax:
unsigned LowestDemandedBit = DemandedMask.countTrailingZeros();
https://reviews.llvm.org/D53036
More information about the llvm-commits
mailing list