[PATCH] D53033: [InstCombine] Demand bits of UMAX

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 9 13:14:30 PDT 2018


craig.topper added inline comments.


================
Comment at: lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp:326-327
+      if (match(RHS, m_APInt(C)) &&
+          DemandedMask.countTrailingZeros() + 1 >
+              C->getBitWidth() - C->countLeadingZeros())
+        return LHS;
----------------
lebedev.ri wrote:
> I wonder if it's any cleaner to write this as
> ```
> C->countLeadingZeros() + DemandedMask.countTrailingZeros() => C->getBitWidth()
> ```
> https://rise4fun.com/Alive/o49
> I.e. that leading zeros (in high bits), and trailing zeros (in low bits) overlap/touch.
How about DemandedMask.countTrailingZeros() >= C->getActiveBits()


https://reviews.llvm.org/D53033





More information about the llvm-commits mailing list