[PATCH] D53036: [InstCombine] Demand bits of UMin
Dave Green via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 10 07:01:43 PDT 2018
dmgreen added inline comments.
================
Comment at: lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp:335-336
+ if (match(RHS, m_APInt(C)) &&
+ DemandedMask.countTrailingZeros() >=
+ C->getBitWidth() - C->countLeadingOnes())
+ return LHS;
----------------
lebedev.ri wrote:
> Nit, probably ignore:
> Is
> ```
> DemandedMask.countTrailingZeros() + C->countLeadingOnes() >= C->getBitWidth()
> ```
> worse?
> I guess you could write it as
> ```
> DemandedMask.countTrailingZeros() >= (~C)->getActiveBits()
> ```
> but that will be less readable, and may be worse if the compiler won't see through the bitwise-inversion.
Yeah, I was trying to make it look like the above umax example. With DemandedMask.countTrailingZeros() >= <something>. I have no strong opinion, let me know if I should change it.
https://reviews.llvm.org/D53036
More information about the llvm-commits
mailing list