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

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 9 12:36:24 PDT 2018


lebedev.ri 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;
----------------
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.


https://reviews.llvm.org/D53033





More information about the llvm-commits mailing list