[PATCH] D51112: [ValueTracking] Teach computeNumSignBits to understand min/max clamp patterns with constant/splat values

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 22 10:59:20 PDT 2018


craig.topper created this revision.
craig.topper added reviewers: spatel, RKSimon, majnemer.

If we have a min/max pair we can do a better job of counting sign bits if we look at them together. This is similar to what is done in the SelectionDAG version of computeNumSignBits for ISD::SMAX/SMIN.

I'm not entirely sure if we can assume the constant is canonicalized to the RHS. So let me know if I need to handle that.

I'm still calling computeNumSignBits on the other input. I don't think SelectionDAG does that. Should the depth limit be bumped by 2 since we went through 2 nodes?


https://reviews.llvm.org/D51112

Files:
  lib/Analysis/ValueTracking.cpp
  test/Transforms/InstCombine/max_known_bits.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51112.162002.patch
Type: text/x-patch
Size: 4555 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180822/00635047/attachment.bin>


More information about the llvm-commits mailing list