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

Dave Green via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 9 12:00:42 PDT 2018


dmgreen created this revision.
dmgreen added reviewers: spatel, craig.topper, efriedma, lebedev.ri.

This is part of of https://reviews.llvm.org/D52508. It uses the demand bits of umax(A, C) to prove we use just A, so long as:
"The lowest non-zero bit of DemandMask is higher than the highest non-zero bit of C"

Unfortunately I don't have a great way to prove this with Alive, as I don't believe it can do clz/ctz's in preconditions. I haven't been able to come up with a counter example, and some Z3 seemed to agree with me (but has a high chance of being wrong, it doesn't have a clz either).

Conceptually, this works because:
if A > C, we pick A. No big deal.
if A < C then all the demanded bits of A == demanded bits of C, so we can pick either and get the same result. So we pick A.


https://reviews.llvm.org/D53033

Files:
  lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
  test/Transforms/InstCombine/minmax-demandbits.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53033.168817.patch
Type: text/x-patch
Size: 4014 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181009/1ee48ddd/attachment.bin>


More information about the llvm-commits mailing list